Re: truncate tables in my tablespace

From: GS <>
Date: Thu, 17 Jan 2008 21:06:45 GMT
Message-ID: <FrPjj.7094$yQ1.1503@edtnps89> 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?
> J

In a nutshell:

spool mytruncate.sql
select 'truncate table '||table_name||';' from dba_tables
where tablespace_name = 'USERS'
spool off

If you are not going to run the generated script as the table owner then add the owner. before the table name

hth Received on Thu Jan 17 2008 - 15:06:45 CST

Original text of this message