Skip to content

Instantly share code, notes, and snippets.

@klaaz0r
Last active October 10, 2018 13:22
Show Gist options
  • Save klaaz0r/467a3231631bd9859db4 to your computer and use it in GitHub Desktop.
Save klaaz0r/467a3231631bd9859db4 to your computer and use it in GitHub Desktop.
Easy deleting tables and sequences in an oracle db
BEGIN
FOR i IN (SELECT *
FROM tabs) LOOP
EXECUTE IMMEDIATE ('drop table '|| i.table_name|| ' cascade constraints'
);
END LOOP;
END;
/
BEGIN
FOR i IN (SELECT us.sequence_name
FROM user_sequences us) LOOP
EXECUTE IMMEDIATE 'drop sequence '|| i.sequence_name||'';
END LOOP;
END;
/
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment