Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: How to check if a table exists or not?
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 CDT
![]() |
![]() |