| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple IF statement
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
|  |  |