Re: Question on the IF Clause

From: Pieter Steenhuis <pieter.steenhuis_at_worldonline.nl>
Date: Wed, 13 Oct 1999 01:55:20 +0100
Message-ID: <3803D878.6F2C02F0_at_worldonline.nl>


Hi Brandon,

You are using a DDL (data definition language) statement in PL/SQL. That doesn't work. If you want to do this, you'll have to use dynamic SQL.

Look for documentation on the DBMS_SQL built-in package.

regards,

Pieter.

Brandon Duncan wrote:

> To anyone who knows the answer:
> Why does the following SQL Block fail on line 8? Are there only certain
> statements which can fall within an IF clause? If, so, what are they?
>
> 1 DECLARE
> 2 llTableExists NUMBER(11,0);
>
> 3 BEGIN
> 4 SELECT INTO llTableExists TABLE_NAME FROM ALL_TABLES WHERE
> TABLE_NAME = 'Table1' AND 5 OWNER = 'OWNER1';
> 6
> 7 IF llTableExists >=1 THEN
> 8 DROP TABLE Table1;
> 9 END IF;
> 10 END;
>
> Thanks,
>
> Brandon
Received on Wed Oct 13 1999 - 02:55:20 CEST

Original text of this message