Tuesday, August 30, 2011

Drop tables in Oracle

Just ran into the situation where I needed to drop all the tables in my test Oracle Database for my user. Of course, one of the ways would be to drop the user all together. But if for whatever reason you don't want to do that (you want to keep your procedures, packages, sequences, triggers, etc. etc.) you can just drop the tables. Run the following command:
select 'drop table '||table_name||' cascade constraints;' from user_tables;
and then execute the results of the query.
EASY!!!!

No comments:

Post a Comment