Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Thursday, 18 August 2011

Drop all tables from schema

Run below code to drop all the tables from schema.

BEGIN

FOR i IN (SELECT table_name FROM user_tables)
LOOP
EXECUTE IMMEDIATE('DROP TABLE ' || user || '.' || i.table_name || ' CASCADE CONSTRAINTS');
END LOOP;
END;