Last active
August 29, 2015 14:01
-
-
Save bhdrk/43cb8a6a0191e0c0ec18 to your computer and use it in GitHub Desktop.
Oracle PL/SQL drop all database tables
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 cur IN (SELECT * FROM DBA_TABLES WHERE OWNER = '<YOUR DATABASE NAME>') | |
LOOP | |
BEGIN | |
EXECUTE IMMEDIATE 'DROP TABLE ' || cur.OWNER || '.' || cur.TABLE_NAME || ' CASCADE CONSTRAINT'; | |
DBMS_OUTPUT.PUT_LINE('SUCCESS: DROP ' || cur.TABLE_NAME); | |
EXCEPTION | |
WHEN OTHERS THEN | |
DBMS_OUTPUT.PUT_LINE('FAILED: DROP ' || cur.TABLE_NAME || ' ' || SQLERRM); | |
END; | |
END LOOP; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to see DMBS_OUTPUT in SqlDeveloper, click to Veiw > Dmbs Output in menu bar. After press Ctrl+N and select your connection on "Select Connection" popup.