Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

If exists check for stored procedure/function

e2a3baba-4de8-4aab-be74-889b1b42e553Oct 29 2014 — edited Dec 1 2014

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?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 29 2014
Added on Oct 29 2014
3 comments
7,753 views