Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Re: Creating a table in Oracle DB if it does not exist, using SQL

Re: Creating a table in Oracle DB if it does not exist, using SQL

From: rob <rob_at_dsdelft.nl>
Date: Mon, 13 Sep 2004 17:12:56 +0200
Message-ID: <ci4dds$3op$1@news.tudelft.nl>


> If someone can take time to write a running sample and send me, I
> would be Grateful.
>
> Thanks,
> Chaitanya.

Something like this?
=== create_test123.sql ===
DECLARE
   c_table_name varchar2(50) := upper('test123');    cursor c1 is
   select table_name
   from user_tables
   where table_name = c_table_name;
BEGIN
   open c1;
   fetch c1 into v_table_name;
   if c1%NOTFOUND
   then

      execute immediate 'create table test123 (n number
                                              ,b varchar2(20)) ' ;
   end if;
   close c1;
END;
/ Received on Mon Sep 13 2004 - 10:12:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US