Home » SQL & PL/SQL » SQL & PL/SQL » Not Exists and Not in (oracle 11g)
Not Exists and Not in [message #476726] Fri, 24 September 2010 16:08 Go to next message
ravi214u
Messages: 153
Registered: February 2008
Location: CANADA
Senior Member
Hi,

when i am running the below two queries i am getting a different result

SELECT count(*) FROM VW_STG_CONTRACTS A 
WHERE NOT EXISTS (SELECT V_ENTITY_CODE FROM VW_FCT_INFO B WHERE A.V_LV_CODE=B.V_ENTITY_CODE)

count(*)
32198

SELECT count(*) FROM VW_STG_CONTRACTS A 
WHERE A.V_LV_CODE NOT IN (SELECT V_ENTITY_CODE FROM VW_FCT_INFO B )

count(*)
0

[Updated on: Sat, 25 September 2010 01:12] by Moderator

Report message to a moderator

Re: Not Exists and Not in [message #476728 is a reply to message #476726] Fri, 24 September 2010 16:33 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9106
Registered: November 2002
Location: California, USA
Senior Member
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:442029737684
Re: Not Exists and Not in [message #476741 is a reply to message #476728] Sat, 25 September 2010 00:52 Go to previous message
Michel Cadot
Messages: 68765
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
SQL> select * from dual where dummy not in ('Y','Z');
D
-
X

1 row selected.

SQL> select * from dual where dummy not in ('Y','Z',null);

no rows selected

Once again, please read Database SQL Reference and use SQL*Plus and keep lines of code do not exceed 80 characters.

Regards
Michel

[Updated on: Sat, 25 September 2010 01:13]

Report message to a moderator

Previous Topic: Tablespace and SGA
Next Topic: PL/SQL procedure successfully completed but not able to view the data
Goto Forum:
  


Current Time: Thu Aug 07 15:46:58 CDT 2025