3 Replies Latest reply on Dec 1, 2014 9:40 PM by rp0428

    If exists check for stored procedure/function

    e2a3baba-4de8-4aab-be74-889b1b42e553

      Hi all,

       

      I am MS SQL developer and new to Oracle. I have a question w.r.t. stored procedures/functions.

       

      Before i create a stored procedure/function, i want to check if it exists and if exists then drop and recreate it.

       

      T-SQL syntax:

       

      The T-SQL syntax would be some thing like the below.

       

      IF EXISTS(SELECT * FROM SYS.OBJECTS WHERE Name = 'ProcName' AND Type = 'P')

           DROP PROCEDURE ProcName

      GO

       

      CREATE PROCEDURE PROCNAME(@VAR1 DATATYPE,@VAR2 DATATYPE)

      AS

      BEGIN

           SQL CODE

      END

       

      Could any of you let me know how this can be implemented in oracle?