Forum Stats

  • 3,752,071 Users
  • 2,250,454 Discussions
  • 7,867,707 Comments

Discussions

CREATE OR REPLACE TABLE

M. Neifer
M. Neifer Member Posts: 49
edited Aug 11, 2009 10:24AM in SQL & PL/SQL
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
Tagged:
3565694

Best Answer

«1

Answers

This discussion has been closed.