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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to conditionally copy and then create it using SQL scripts

Re: How to conditionally copy and then create it using SQL scripts

From: Ron Reidy <ron_at_indra.com>
Date: Wed, 10 Oct 2001 05:27:05 -0600
Message-ID: <3BC43089.356EEE4B@indra.com>


zl wrote:
>
> In SQL server, the following SQL statements can be used to create a
> table if it is not existed.
>
> IF EXISTS (SELECT * FROM sysobjects
> WHERE name = 'BusinessDocIdGenerator'
> AND type = 'U')
> DROP TABLE BusinessDocIdGenerator
>
> CREATE TABLE BusinessDocIdGenerator (
> NumericGeneratorId int NULL,
> .....
> )
>
> How can I do this in Oracle? Oracle doens't allow "if" appears in
> sqlplus.

You have to use PL/SQL and dynamic SQL. See the docs.

-- 
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.
Received on Wed Oct 10 2001 - 06:27:05 CDT

Original text of this message

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