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: Checking for table existance

Re: Checking for table existance

From: Saad Ahmad <saad.ahmad_at_mchugh.com>
Date: 22 Apr 1998 15:58:15 GMT
Message-ID: <01bd6e07$6f070780$2207030a@sahmad-pc.mfa.com>


Why make the code dependent on all_tables ???

Just do the create table and handle the exception ...

mpir_at_compuserve.com wrote in article <6hkshq$80p$1_at_nnrp1.dejanews.com>...
> As a variant:
>
> Select 'It Lives' Search from all_tables where table_name='TABLE' and
> owner='OWNER';
>
>
> In article <01bd6d78$944e8980$a51c67d1_at_iosif>,
> "Iosif Tanasescu" <a_at_j.smith> wrote:
> >
> >
> > I'd like to check for the existance of a table before I create it
> >
> > Declare
> > Nr integer;
> > begin
> > Select count(*) into nr
> > from all_tables
> > where table_name = 'YOUR_TABLE_NAME'
> > and owner= 'YOUR_OWNER';
> > if nr = 1 then
> > dbms_output('I FOUND"IT');
> > else
> > dbms_output('Not yet created;');
> > end if;
> > end;
> >
> >
>
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
>
Received on Wed Apr 22 1998 - 10:58:15 CDT

Original text of this message

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