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: Use of Exists in an If statement-URGENT!!!

Re: Use of Exists in an If statement-URGENT!!!

From: Tom Zamani <tomz_at_redflex.com.au>
Date: 2000/06/22
Message-ID: <8irpm6$3m3$1@perki.connect.com.au>#1/1

you can not use the select inside a if block.

 if duration >= 7 and duration < 28 then

begin
select 'x' into char1 from InvRentalprice where EXISTS (select #  from InvRentalPrice where unit = 0);
exception
when no_data_found then

    char1:='Y';
end

   if (char1='x') then

      unit := 0;
    else

Tom

anurag <aminochaNOamSPAM_at_unibiz.com.invalid> wrote in message news:09dd2ecc.13f8e8d8_at_usw-ex0105-034.remarq.com...
> Hi,
> I am trying to use the following syntax in a stored procedure to
> see whether a particular value exists in a table. But it gives
> me an error. This I am doing so that it does not throw a
> no_data_found exception which I have to explicitly handle.
>
> The piece of code which is giving me error is
>
> if duration >= 7 and duration < 28 then
>
> if (select 'x' from InvRentalprice where EXISTS (select #
> from InvRentalPrice where unit = 0)) then
>
> unit := 0;
> else
>
> and the error is
> LINE/COL ERROR
> -------- --------------------------------------------------------
> 29/9 PLS-00103: Encountered the symbol "SELECT" when
> expecting one of the following:
> ( - + mod not null others <an identifier>
> <a double-quoted delimited-identifier> <a bind
> variable> avg count current exists max min prior sql stddev sum
> variance cast <a string literal with character set
> specification> <a number> <a single-quoted SQL string>
>
> 29/118 PLS-00103: Encountered the symbol "THEN" when expecting
> one of the following: ) intersect minus union
>
>
>
> Got questions? Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com
>
Received on Thu Jun 22 2000 - 00:00:00 CDT

Original text of this message

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