visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Databases :: Oracle :: "drop table if exists" in Oracle ? ORA-00933


By: Bernard France  Date: 07/09/2005 23:44:11  English  Points: 20 Status: Answered
Quality : Excellent
is it feasible like in MySql ?

drop table if exists toto; create table toto (...DDL...);

By: VGR Date: 07/09/2005 23:49:28 English  Type : Answer
Hello,

This is closely linked to the already-answered PAQed question ["if not exists" SQL statement in Oracle ?] but you can have a new answer anyway ;-)

You have to use PL/SQL to write some kind of stored procedure :

Begin execute immediate 'Drop table toto'; Exception when others then null; End; / create table toto (...DDL...);



or you can also use this kind of code :

DECLARE exists PLS_INTEGER; BEGIN select count(*) into exists from user_tables where table_name = 'toto'; if exists = 1 then execute immediate 'drop table toto'; end if; END; / create table toto ( ...DDL...);


Do register to be able to answer

EContact
browser fav
page generated in 292.405840 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page