Hi Guys,
I have this following table testin:
SQL> desc testin
Name Null? Type
------------------------------- -------- ----
NAME VARCHAR2(20)
SEX NOT NULL CHAR(1)
These are the records available in testin table:
SQL> SELECT * FROM TESTIN;
NAME S
-------------------- -
GABBIE F
F
F
TINA F
GLADIA F
KEVIN M
GIVANI M
JOHN M
SHIVA M
9 rows selected.
There are 2 rows for which NAME column has NULL value. But when i give the following query which has a NULL value in it, no rows are selected.
SQL> SELECT * FROM TESTIN WHERE NAME NOT IN('GABBIE','GLADIA',NULL);
no rows selected
and if take the NULL from the NOT IN condition, i get the follwoing results.
SQL> SELECT * FROM TESTIN WHERE NAME NOT IN('GABBIE','GLADIA');
NAME S
-------------------- -
TINA F
KEVIN M
GIVANI M
JOHN M
SHIVA M
The records with Null Values are not Returned.
Somebody please explain me this.
Thanks in Advance,
Regards,
Shiva