Home » SQL & PL/SQL » SQL & PL/SQL » table exists .. or not
table exists .. or not [message #37505] Tue, 12 February 2002 10:36 Go to next message
drewmoo
Messages: 6
Registered: February 2002
Junior Member
any quick way i can figure out if a table exists or not in a database ? i know i can use tablename.exists(1) to see if any rows exists, but this isn't exactly what i need.
will i have to run a SQL against the table and trap for a 'table or view not found' error ?
Re: table exists .. or not [message #37506 is a reply to message #37505] Tue, 12 February 2002 11:03 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
write a proc using a query something like this:
select 1 into v_dummy from all_tables where table_name='EMP' and owner='SCOTT';
or
select 1 into v_dummy from user_tables where table_name = 'EMP';
if v_dummy = 1
then return true;
else return false;
end if;

you can also test against sql%rowcount
Previous Topic: create a csv ?
Next Topic: after coding the sucessful cursor what are the steps to get the cursor output
Goto Forum:
  


Current Time: Mon Sep 27 17:54:14 CDT 2021