| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: IF NOT EXISTS SELECT ...
In <53vsnr$7uf_at_newstoo.ericsson.se>, eraarm_at_hfera.ericsson.se (Armin S. Seidel LK/NKG) writes:
>I would like to test the existence of rows as condition
>in a PL/SQL if-clause:
> IF NOT (EXISTS SELECT * FROM table WHERE col = value) THEN
> ...
> END IF;
>
>but Oracle complains about the syntax. I tried different variations
>with/without parentheses without success.
>Apparently, the EXISTS operator may only be used in subqueries.
>Can you help?
>
>-- Armin
>_______________________________________________________________________
>Armin.Seidel_at_hfera.ericsson.se KI/ERA/LK/NK +46(0)8-404 2456
> extr.qraarmi@memo.ericsson.se http://www.hfera.ericsson.se:/~eraarm/
> armin_at_independent.se www.independent.se +46(0)70-7277822
>
Armin,
If you declare and fetch from a cursor, you can then use
if cursor-name%notfound then
.....
end if
Bye,
Steve
| any similarity 'tween my opinions and that | | of my employers are purely hypothetical | | and should give no cause for alarm | --------------------------------------------Received on Tue Oct 15 1996 - 00:00:00 CDT
![]() |
![]() |