Last active
June 5, 2020 14:48
-
-
Save gigadot/1e683c41dac3b5953f025a589a7d079a to your computer and use it in GitHub Desktop.
Script for deleting all tables in the Oracle database
This file contains hidden or 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 c IN (SELECT table_name FROM user_tables) | |
LOOP | |
EXECUTE IMMEDIATE ('DROP TABLE "' || c.table_name || '" CASCADE CONSTRAINTS'); | |
END LOOP; | |
EXECUTE IMMEDIATE 'PURGE RECYCLEBIN'; | |
FOR s IN (SELECT sequence_name FROM user_sequences) | |
LOOP | |
EXECUTE IMMEDIATE ('DROP SEQUENCE ' || s.sequence_name); | |
END LOOP; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment