Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: simple SQL Question
Examples (anonymous pl/sql blocks require 8i - prior to 8i use dbms_sql instead)
declare
v_count number;
v_table varchar2(200) := 'THIS_IS_NOT_MS';
begin
select count(*)
into v_count
from user_tables where table_name = v_table;
if v_count = 1 then
execute immediate 'drop table ' || v_table;
end if;
end;
or brute force on command line:
drop table this_is_not_ms;
or brute force in procedures:
begin
execute immediate 'drop table this_is_not_ms';
exception
when others then null;
end;
Christian Dicke <dicke_at_x-dot.de> schrieb in im Newsbeitrag:
98ast8$tok$1_at_redenix.uni-muenster.de...
> Hello all,
>
> could anyone tell me, how to find out, if a table exists?
> I want to s.th. like this:
>
> DROP TABLE IF EXISTS <tablename>
>
> Greetingz and thank you!
> Christian
>
>
Received on Fri Mar 09 2001 - 10:29:32 CST
![]() |
![]() |