Skip to main content

Posts

Showing posts from April, 2015

oracle drop all tables and sequences in a certain schema

--  please never put a comment starting with " / "  as this character means execute the previous line  BEGIN   FOR i IN (SELECT us.sequence_name               FROM USER_SEQUENCES us) LOOP     EXECUTE IMMEDIATE 'drop sequence '|| i.sequence_name ||'';   END LOOP;     FOR i IN (SELECT ut.table_name               FROM USER_TABLES ut) LOOP     EXECUTE IMMEDIATE 'drop table '|| i.table_name ||' CASCADE CONSTRAINTS ';   END LOOP; END; -- the following character executes the whole block of pl sql code /