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: [Question]drop all tables owned by a user

Re: [Question]drop all tables owned by a user

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Wed, 26 Jan 2005 22:02:57 +0800
Message-ID: <41F7A311.2376@yahoo.com>


anonymous wrote:
>
> Is it possible to drop all tables by user who owns those tables in one
> sqlstatement? for instance, I have a user who has A, B, C ... Z
> tables.
> Then I want to drop all those tables by sql statement. is it possible?
> If yes, how?
> I appreciate any suggestion, sincerely.

begin
  for i in ( select table_name from user_tables ) loop     execute immediate 'drop table '||i.table_name||' cascade constraints';
  end loop
end;
/

-- 
Connor McDonald
Co-author: "Mastering Oracle PL/SQL - Practical Solutions"
Co-author: "Oracle Insight - Tales of the OakTable"

web: http://www.oracledba.co.uk
web: http://www.oaktable.net
email: connor_mcdonald_at_yahoo.com


"GIVE a man a fish and he will eat for a day. But TEACH him how to fish,
and...he will sit in a boat and drink beer all day"

------------------------------------------------------------
Received on Wed Jan 26 2005 - 08:02:57 CST

Original text of this message

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