Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

two tricky SQLs with NULL in IN list

user60022Nov 8 2010 — edited Nov 8 2010
Hi All,

select 'true' from dual where (1,2) not in ((2,3),(2,null)); --One row
select 'true' from dual where (1,null) not in ((1,2),(2,3)); -- 0 row

Could someone tell me why it is, please?

As far as I know, the first SQL will be translated to
(1,2) !=(2,3) AND (1,2) != (2, null)

Since NULL is invovled, the latter branch will be evaluated to NULL(I guess), then no row should be returned.
I am completely confused by the difference between these two SQLs.

Best regards,
Leon
This post has been answered by MichaelS on Nov 8 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 6 2010
Added on Nov 8 2010
7 comments
1,707 views