Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: IF NOT EXISTS SELECT ...
In <DzC4Fn.E91_at_msi.com> swc_at_msi.com (Stephen W. Cook) writes:
>Try it like this :
> IF NOT EXISTS ( SELECT * FROM table WHERE col = value) THEN
>good luck!
>Stephen Cook
This produces the following PL/SQL compile error:
PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL statement only
So you'll have to use a different approach (which others have already suggested).
>In article <53vsnr$7uf_at_newstoo.ericsson.se>, eraarm_at_hfera.ericsson.se wrote:
>>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?
>>
-- ------------------------------------------------------------------------------ Computer General Rochester, NY (716) 436-6372 "... providing general computer solutions to specific business problems" gwn_at_servtech.comReceived on Wed Oct 16 1996 - 00:00:00 CDT