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

Home -> Community -> Usenet -> c.d.o.misc -> Re: DROP table <some table>;

Re: DROP table <some table>;

From: Joel Garry <joelga_at_rossinc.com>
Date: 1997/02/13
Message-ID: <1997Feb13.184802.6446@rossinc.com>#1/1

In article <5dtr0t$gi_at_ns2.southeast.net> garyg_at_users.jaxnet.com (Gary M. Greenberg) writes:
>In Oracle, The Complete Reference the examples for sqlplus to
>create a table start with:
>drop table <the table to be created>;
>create table <the table> ( ...
>
>Now, I understand that the error is ignorable, but as a
>programmer it bothers me not to 1st check for the table's
>prior existence. So, how does one begin such a SQL script
>wherein the logic would be:
>
>if (<the table to be created> exists) then
>drop table <the table>
>end
>create table ...

You could populate a table adding a bunch of rows based on (select count(*) from all_tables where table_name='your_table';) =1 , then create a bunch of create tables based on WHERE NOT IN the table, but it would be slow. Perhaps you should ask oracle for a "create or replace" syntax on the create table, or write a script to remove ignorable errors from your creation log.

>
>Reply by post and/or email at your preference.
>Thanks,
>
>
>gary The C Programmer's Reference:
> http://users.southeast.net/~garyg/C_ref/C/c.html
> AVENUE Class Requests Index:
> http://users.southeast.net/~garyg/class.htm

-- 
Joel Garry               joelga_at_rossinc.com               Compuserve 70661,1534
These are my opinions, not necessarily those of Ross Systems, Inc.   <> <>
%DCL-W-SOFTONEDGEDONTPUSH, Software On Edge - Don't Push.            \ V /
panic: ifree: freeing free inodes...                                   O
Received on Thu Feb 13 1997 - 00:00:00 CST

Original text of this message

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