Last active
August 29, 2015 14:17
-
-
Save lucansky/97ccfac1ab2d414d15b6 to your computer and use it in GitHub Desktop.
IDS drop all sequences and 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
-- source: http://stackoverflow.com/questions/2549718/dropping-all-user-tables-sequences-in-oracle | |
DECLARE | |
login varchar2(8); | |
BEGIN | |
-- Change value according to your username | |
login := 'XLUCAN01'; | |
-- Remove all sequences | |
FOR i IN (SELECT us.sequence_name, us.sequence_owner | |
FROM ALL_SEQUENCES us WHERE sequence_owner = LOGIN) LOOP | |
EXECUTE IMMEDIATE 'drop sequence '|| i.sequence_name ||''; | |
END LOOP; | |
-- Remove all tables | |
FOR i IN (SELECT ut.table_name | |
FROM ALL_TABLES ut WHERE owner = LOGIN) LOOP | |
EXECUTE IMMEDIATE 'drop table '|| i.table_name ||' CASCADE CONSTRAINTS '; | |
END LOOP; | |
END; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment