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: Simple IF statement

Re: Simple IF statement

From: Samuel Leung <m2624526_at_netvigator.com>
Date: Tue, 24 Aug 1999 17:49:02 +0800
Message-ID: <7ptokm$p24$1@imsp009a.netvigator.com>


Or try:

Declare
  dummy ....
Begin
  Select .... INTO dummy FROM .....
  IF SQL%FOUND THEN
     ...
  ELSE
     ...
  END IF;
End;

Dan Fluet wrote in message <37C160B8.FCF11D5C_at_bdsinc.com>...
>I know this should be easy but it is Monday.
>
>In SQL Server there is an IF EXISTS function. Is there anything
>similiar to that in Oracle? Here is a simplified query of what I am
>trying to do.
>
>If there is something in the daily_sales do the first select if not do
>the second.
>
>BEGIN
> IF (SELECT COUNT(*) FROM daily_sales) < 1 THEN
> SELECT * FROM author;
> ELSE
> SELECT * FROM other;
> END IF;
>END;
>
Received on Tue Aug 24 1999 - 04:49:02 CDT

Original text of this message

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