Naveen,

The column does have nulls and this was the problem. Thanks for the insight.

 

Thanks


Siddharth Haldankar

Zensar Technologies Ltd.

Cisco Systems Inc.

(Offshore Development Center)

#  : 091 020 4128394

[EMAIL PROTECTED]

[EMAIL PROTECTED]

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Naveen, Nahata (IE10)
Sent: Thursday, December 18, 2003 11:59 AM
To: Multiple recipients of list ORACLE-L
Subject: RE: Any known problems using NOT IN ?

 

Doess the column crs.os_id_fk1 contain nulls?

 

Regards

Naveen

-----Original Message-----
From: Siddharth Haldankar [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 18, 2003 10:54 AM
To: Multiple recipients of list ORACLE-L
Subject: Any known problems using NOT IN ?

Hi Gurus,

 

I have a problem using NOT IN clause in Oracle. However using NOT EXISTS, gives me the right output. Are there any known limitations.

 

This query selects from the master records wherein child records are not active.

 

select * from ct_software_release csr where

  csr.class         = 'NS'

  AND    csr.active_flag   = 'Y'

  AND    csr.os_id_pk not IN

  (SELECT crs.os_id_fk1 FROM CT_ROADMAP_SOFTWARE crs

        WHERE crs.active_flag  = 'Y');

 

The sub-query in the above case gives 1800 rows. The above query fails to give any rows.

                                                                                 

select * from ct_software_release csr where

  csr.class         = 'NS'

  AND    csr.active_flag   = 'Y'

  AND    NOT EXISTS

        (SELECT 1 FROM CT_ROADMAP_SOFTWARE crs

        WHERE crs.os_id_fk1 = csr.os_id_pk

                                AND crs.active_flag  = 'Y');                                                           

 

This above query works fine.

 

 

 

Thanks


Siddharth Haldankar

Zensar Technologies Ltd.

Cisco Systems Inc.

(Offshore Development Center)

#  : 091 020 4128394

[EMAIL PROTECTED]

[EMAIL PROTECTED]

 

 

Reply via email to