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: Reg. 'drop table' statement

Re: Reg. 'drop table' statement

From: Christof Kaiser <kaiser_at_logiball.de>
Date: Mon, 18 Aug 2003 15:12:51 +0200
Message-ID: <3F40D0D2.FD29824@logiball.de>

qazmlp schrieb:

> I want to drop the table where table names ends with 'TESTTABLE'.
> I tried with this:
> drop table (select tname where tname like '%TESTTABLE');
>
> But, it does not work.
>
> Please help me to fix it.
>
> Thanks!

that wouldnt work. but try a bit of pl/sql with an execute immediate:

declare
 cursor my_cur IS
 select table_name from tabs where table_name like '%TESTTABLE'; begin
 for tab in my_cur
 loop
   execute immediate 'drop table '||tab.table_name;  end loop;
end;
/

I havent run the code (dont want to drop anything), but it should work.

Reagards
Christof

ps: please dont cross-post!!! Received on Mon Aug 18 2003 - 08:12:51 CDT

Original text of this message

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