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

Home -> Community -> Usenet -> c.d.o.tools -> Re: simple SQL Question

Re: simple SQL Question

From: Klaus Zeuch <KZeuchnospam_at_hotmail.com>
Date: Fri, 9 Mar 2001 17:29:32 +0100
Message-ID: <98b44q$p2s$1@papyrus.erlm.siemens.de>

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

Original text of this message

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