Re: Question on the IF Clause

From: <pberetta_at_my-deja.com>
Date: Wed, 13 Oct 1999 00:07:36 GMT
Message-ID: <7u0ifv$l1f$1_at_nnrp1.deja.com>


Brandon,
  Several possible causes

  1. you appear to be trying to select a varchar2 column into a numeric variable - won't work Try: select count (*) into llTableExists from all_tables where table_name = 'TABLE1' and owner = 'OWNER1';
  2. if user running the script is not the owner of the table being dropped or has not been granted "drop" on it - won't work

What is the exact error message you receive?

Paul

In article <7u08co$d1r$1_at_autumn.news.rcn.net>,   "Brandon Duncan" <BDuncan_at_PIETECHNET.com> 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
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Oct 13 1999 - 02:07:36 CEST

Original text of this message