Re: truncate tables in my tablespace
From: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: Fri, 18 Jan 2008 10:03:19 +0100
Message-ID: <bc72c$47906b57$524b5c40$1087@cache2.tilbu1.nb.home.nl>
>> 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
As Arun indicated, you'll have to disable constraints. Better add an exception handler to the code above to silently continue when failing.
Date: Fri, 18 Jan 2008 10:03:19 +0100
Message-ID: <bc72c$47906b57$524b5c40$1087@cache2.tilbu1.nb.home.nl>
loosethisskin wrote:
> On Jan 17, 1: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
> > begin > for t in (select table_name from user_tables) > loop > execute immediate('truncate table ' || t.table_name); > end loop; > end; > /
As Arun indicated, you'll have to disable constraints. Better add an exception handler to the code above to silently continue when failing.
-- Regards, Frank van Bortel Top-posting in UseNet newsgroups is one way to shut me upReceived on Fri Jan 18 2008 - 03:03:19 CST