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: Question on the IF clause

Re: Question on the IF clause

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Sun, 24 Oct 1999 18:29:59 +0200
Message-ID: <940783169.26108.2.pluto.d4ee154e@news.demon.nl>


You have two errors
on line 4 you should select <any expression> into llTableExists.

On line 8 the command drop table is not allowed as it is a DDL command. You need to replace that by calls to dbms_sql (V7, 8) or execute immediate (8i).

Hth,

--
Sybrand Bakker, Oracle DBA
Brandon Duncan <BDuncan_at_PIETECHNET.com> wrote in message news:7u08be$cqd$1_at_autumn.news.rcn.net...
> 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 Sun Oct 24 1999 - 11:29:59 CDT

Original text of this message

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