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: Table Existence

Re: Table Existence

From: Skip Cope <scope_at_us.oracle.com>
Date: Sun, 05 Mar 2000 16:37:49 -0500
Message-ID: <38C2D3AD.EB943C73@us.oracle.com>


Louis Frolio wrote:
>
> Is there a sql command in Oracle that will tell me whether or
> not a table exists? In T-SQL the command "IF EXISTS(..)" does
> just this. Any help would be appreciated.
>
> L

The easiest way is to simply check the data dictionary. For example..

declare
cnt number;
begin
select count(*) into cnt from user_tables -- or all_tables  where table_name = 'WHATEVER_TABLE';
if cnt = 0 then

FYI,
Skip Cope
Principal Consultant
 __ _ _ __ __
(__)|-< /-\(__ |__(-_

 Pager #800-664-3606

 Quote of the day -
"I have never let my schooling interfere with my education."  Mark Twain Received on Sun Mar 05 2000 - 15:37:49 CST

Original text of this message

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