Frank,

"A NOT IN evaluates to FALSE if *any* member of the set is NULL".

http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/
a85397/operator.htm#1003933

Also scroll up just a tad on that link and look at the comments for NOT IN
in table 3.4. This is a subtlety that many folks overlook until it bites
them on the tail.

With regards to your NOT EXISTS, you didn't include correlation between the
two tables (which Amar pointed out with the example). Try this:

SQL> select * from fk_ldm1 a
  2  where not exists (select * from fk_ldm2 b where a.id = b.id);

        ID
----------
         3

For each row in fk_ldm1 the sub-query is evaluated. And since you did not
include correlation, the sub-query will always return a row(s) (there's no
criteria on it), thus making the NOT EXISTS condition FALSE for each row in
fk_ldm1.


Regards,

Larry G. Elkins
[EMAIL PROTECTED]
214.954.1781

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Kuijten, F.
> (Frank)
> Sent: Monday, October 29, 2001 8:35 AM
> To: Multiple recipients of list ORACLE-L
> Subject: RE: NOT IN with NULL-values
>
>
> Amar,
>
> Thanks.
>
> One question : Do you have a NULL value in the 'am91' table ?
>
> Because that's where my problem is.
> Without the NULL value, all queries are giving the expected results.
>
>
> Greetings,
> Frank
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Larry Elkins
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to