Re: truncate tables in my tablespace
Date: Fri, 18 Jan 2008 02:53:36 -0800 (PST)
On 18 Jan, 09:03, Frank van Bortel <frank.van.bor..._at_gmail.com> wrote:
> 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.
> Frank van Bortel
> Top-posting in UseNet newsgroups is one way to shut me up- Hide quoted text -
> - Show quoted text -
Thanks you all for the very thorough answers- One question remains tho. My intention is the thro all the data away so would delete from tablename have the same restriction with constraints as truncate? J Received on Fri Jan 18 2008 - 04:53:36 CST