Last active
October 10, 2018 13:22
-
-
Save klaaz0r/467a3231631bd9859db4 to your computer and use it in GitHub Desktop.
Easy deleting tables and sequences in an oracle db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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