Drop all user schema tables

Tuesday May 26th 2009 by DatabaseJournal.com Staff
Share:

Using cascade constraints you can drop all tables from user schema.



>>Script Language and Platform: SQL*PLUS
Using cascade constraints you can drop all tables from user schema.

Author: Paul Nersesov


SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET MARKUP HTML OFF
SET ESCAPE \
SPOOL drop_tables.sql
 select 'drop table ', table_name, 'cascade constraints \;' from user_tables;
/
 select 'drop sequence ',object_name,'\;' from user_objects where object_type='SEQUENCE';
/
 SPOOL OFF
@drop_tables.sql
 SET ECHO ON
 SET FEEDBACK ON
 SET HEADING ON
 

Disclaimer: We hope that the information on these script pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, or fitness for a particular purpose... Disclaimer Continued


Back to Database Journal Home

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved