【发布时间】:2018-06-22 05:57:53
【问题描述】:
在 oracle 中,为什么“Not in”对空值不起作用,但“IN”起作用 例如
with temp(n,p) as (
select 1,2 from dual union all
select 3,2 from dual union all
select 4,6 from dual union all
select 5,6 from dual union all
select 2,8 from dual union all
select 6,8 from dual union all
select 8,null from dual
)
1. Select * from temp where n in (2,6,8,null);
2. Select * from temp where n not in (2,6,8,null);
First Statement 将给出输出 = 2,6,8 第二条语句不会给出任何输出
谁能解释一下原因?
【问题讨论】:
-
它可以正常工作。你期待什么结果?