Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop IF EXISTS

Status
Not open for further replies.

howzatUK

IS-IT--Management
Oct 14, 2005
23
0
0
GB
CREATE OR REPLACE PROCEDURE DeleteIfExists
AS
iexists Number;
BEGIN
select count(*) into iexists from user_tables where table_name = 'tmpFIXDCActns';
if
iexists := 1
then execute immediate 'drop table tmpFIXDCActns';
end if;
END;

I was told that the in ORACLE you cannot use DROP IF EXISTS and writting the above code is a way around this.

However the above proc compiles with errors. Can anyone tell me why that is?

Thank you in advance


 
1. You may make an attempt to drop and then catch an error instead.
2. Most names in Oracle are in uppercase.
3. := assigns, not compares.

Regards, Dima
 
thank you. Ofcourse!!!! the problem was number 3) :=

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top