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

From: Wario <sergeant.rock_at_gmail.com>
Date: 13 Sep 2004 13:27:22 -0700
Message-ID: <c75b43bb.0409131227.753e79bc_at_posting.google.com>


  1. Create a file with your table definition. Your could call it anything you want with a SQL extention. EXAMPLE mynewtable.sql:

    create table &1..new_table (

       col1  char(1),
       col2  char(1),
       col3  char(1),
       col4  char(1)
       );

2. Logon to database with DBA rights and call mynewtable.sql with user name as parameter.

    sqlplus dba/password

    SQL> _at_mynewtable scott

3. Repeat #2 for every user. This will create the table for each user. There is no need to check if the table already exists since trying to create the table will error out and not harm the existing table. Received on Mon Sep 13 2004 - 22:27:22 CEST

Original text of this message