Re: truncate tables in my tablespace

From: Arun Mathur <themathurs_at_gmail.com>
Date: Thu, 17 Jan 2008 18:00:11 -0800 (PST)
Message-ID: <1f9dadde-7e7e-4178-8024-dd2198f8ab43@x69g2000hsx.googlegroups.com>


On Jan 17, 4:05 pm, EdStevens <quetico_..._at_yahoo.com> wrote:
> On Jan 17, 12:50 pm, burrell.j..._at_yahoo.com wrote:
>
> > Hello,
> > I want to delete all the data in all the tables in my tablespace.
> > SQL> select table_name from user_tables;
> > I can get a list of the tables but I dont want to a
> > for each table type in
> > SQL> delete from tablename;
> > Is there a smart way of doing this?
>
> > TIA
> > J
>
> Use a script to write a script:
>
> spool doit.sql
> --
> select 'truncate table ' || table_name || ';'
> from user_tables;
> --
> spool off
>
> Of course, you'll also want to set some things in sqlplus to supress
> column headers, page breaks, etc. so that doit.sql is a clean,
> executable sql script -- or just manually clean it up before executing
> it.

Hello,

The foreign key constraints will need to be disabled before truncating:

http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_107a.htm#2067578

Regards,
Arun Received on Thu Jan 17 2008 - 20:00:11 CST

Original text of this message