Re: Table Existence
From: Skip Cope <scope_at_us.oracle.com>
Date: 2000/03/05
Message-ID: <38C2D3AD.EB943C73_at_us.oracle.com>#1/1
Date: 2000/03/05
Message-ID: <38C2D3AD.EB943C73_at_us.oracle.com>#1/1
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
- error logic... end if; end; /
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 - 00:00:00 CET
