table exists .. or not [message #37505] |
Tue, 12 February 2002 10:36 |
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 |
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
|
|
|