Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Remove all tables for user with one SQl statement?

Re: Remove all tables for user with one SQl statement?

From: Robert Klemme <bob.news_at_gmx.net>
Date: Mon, 19 Dec 2005 13:19:16 +0100
Message-ID: <40nmqaF1ag8saU1@individual.net>


Thomas Kellerer wrote:
> On 19.12.2005 10:21 sybrandb_at_yahoo.com wrote:
>> You can't.
>> You can of course
>> begin
>> for tab in (select table_name from dba_tables where owner=
>> 'UserName' ) loop
>> execute immediate 'drop table Username.'||tab.table_name||' cascade
>> constraints';
>> end loop;
>> end;
>> /
>> But you would need to make sure there are no foreign keys or drop the
>> tables in the right order.
>
> Hmm, this confuses me a bit.
>
> A "DROP TABLE xyz CASCADE CONSTRAINTS" will remove all constraints on
> the table as well, including foreign keys.
>
> So the order shouldn't actually matter in that case, shouldn't it?

And what do you do if a table X referencing table A you're about to delete references it?

    robert Received on Mon Dec 19 2005 - 06:19:16 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US