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

Home -> Community -> Usenet -> c.d.o.misc -> Re: PLSQL: how to test if a table exists?

Re: PLSQL: how to test if a table exists?

From: Guido Konsolke <GK_at_oblivion.com>
Date: Thu, 4 Dec 2003 12:40:51 +0100
Message-ID: <1070537184.838587@news.thyssen.com>


"NoName" wanted this group to know...
> Hello,
>
> in a PLSQL script, I want to execute code only if a certain table
exists.
> A pseudo-solution could be:
>
> declare
> cursor c1 is select * from notable;
> begin
> open c1;
> if c1%ISOPEN then
> -- statements to execute if table exists
> end if;
> end;
>
> Obviously, the above code is not correct, first of all the script
throws an
> execption if "notable" doesn't exist.
> Any workaround?
>
> Thank you
>

Hi Nameless,

you could check the existence with a query against the data dictionary.
Then handle the result / error.

hth,
Guido Received on Thu Dec 04 2003 - 05:40:51 CST

Original text of this message

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