Skip to Main Content

SQL & PL/SQL

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

CREATE OR REPLACE TABLE

M. NeiferAug 11 2009 — edited Aug 11 2009
Hi, i need to write a script that re-creates a table. Something similar to CREATE OR REPLACE VIEW. I came up with the following
DECLARE
   does_not_exist   EXCEPTION;
   PRAGMA EXCEPTION_INIT (does_not_exist, -942);
BEGIN
   EXECUTE IMMEDIATE 'DROP TABLE foobar';
EXCEPTION
   WHEN does_not_exist
   THEN
      NULL;
END;
/

CREATE TABLE foobar (c1 INT);
I wonder if there's an easier way. Is there?

TIA, Markus
This post has been answered by SomeoneElse on Aug 11 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 8 2009
Added on Aug 11 2009
13 comments
124,227 views