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: Exist clause in PL/SQL

Re: Exist clause in PL/SQL

From: Richard Kuhler <noone_at_nowhere.com>
Date: Mon, 12 Nov 2001 18:35:20 GMT
Message-ID: <IDUH7.33329$D5.11895041@typhoon.san.rr.com>


How about:

declare
  dummy integer;
begin
  select rownum
  into dummy
  from table1
  where ...
    and rownum = 1;

  exception
    when no_data_found then
      insert into table1 ...
end;

Yaron Avior wrote:
>
> Hi,
> Is there in PL/SQL any replacement for SQL-Server's "If exist/If not
> exist" clause?
> I need to do something like : if not exists (select * from Table1
> where Field1=...) Insert into Table1 (Field1, Field2,...) values (...,
> ...,...)
>
> thanks
Received on Mon Nov 12 2001 - 12:35:20 CST

Original text of this message

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