Re: PL/SQL: How to check if a table exists or not?
From: Alexander G. Andzelevitch <aga_at_parad.ru>
Date: 1997/09/01
Message-ID: <01bcb6b3$13a01230$38a7d1c3_at_aga>#1/1
Date: 1997/09/01
Message-ID: <01bcb6b3$13a01230$38a7d1c3_at_aga>#1/1
Michael A. Casillas <casillas_at_icepr.com> wrote in article
<34047555.2D31BB02_at_icepr.com>...
> Yet another one:
>
> How can I check in PL/SQL if a table exists or not. Is there a built in
> function that can return TRUE or FALSE? I know the table name, I just
> want to know if it's there or if I have to create it. Thanks in
> advance.
>
> Michael Casillas
>
>
In your case the better way may be not to check table existence, but just
write following
BEGIN
CREATE TABLE <My_Table> ...; -- always try to create table
EXCEPTION
WHEN OTHERS THEN -- Catch all possible exceptions
NULL; -- nothing to do.
END;
If My_Table is not constant then use dbms_sql package to execute "create
table ..." script.
-- Alexander G. AndzelevitchReceived on Mon Sep 01 1997 - 00:00:00 CEST