13 Replies Latest reply: Aug 11, 2009 9:24 AM by 624104 RSS

    CREATE OR REPLACE TABLE

    M. Neifer
      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