Oracle:1 not in (null)检索不出结果
in/not in在判断NULL时用的与=/<>一样的方式,即必须用is null来判断,否则始终为失败。
语句
select 'true' from dual where (1,2) not in ((2,3),(2,null));
成功的原因在于判断二元值时首先判断其中一个非null元素,该元素成功或者失败会“短路”另一个个。由于上述第一个元素就使not in成功了,因此第二个元素就不再处理。
语句
select 'true' from dual where (2,1) not in ((2,3),(2,null));
的第一个元素没有造成“短路”,因此引起了null判断,从而结果始终为失败。
请再实验语句
select 'true' from dual where (2,1) not in ((2,3),(null,3));
其结果为true,原因是第二个元素短路了第一个元素。
以上分析纯属个人观点,仅供参考。
转自http://topic.csdn.net/t/20041230/12/3688313.html
相关文档:
Lately,
Jordan bank upgraded their ICBS banking software to Oracle 9i and
IDS9i. The Bank also moved from a decentralized to a centralized
system.
We were contracted to monitor and diagnose performance issues during the launching phase of the new system.
The IBM server was equipped with 32 GB o ......
1z0-047 资料的最新分享,下面一些题目是从最新的题库中精心整理出来的,质量很高,需要的朋友看过来的啊。
1. Which statements are true? (Choose all that apply.)
A. The data dictionary is created and maintained by the database administrator.
B. The data dictionary views can consist of joins of dictiona ......
ORACLE 10 学习笔记-第2节-命令。
1. inner join / left join/ right join / full join
select a.dname, b.ename from dept a, emp b where a.deptno=b.deptno and a.deptno=10;
select a.dname, b.ename from dept a inner join emp b
on a.deptno=b.deptno and a.deptno=10;
select dname,ename from dept natural ......
PL/SQL
块结构
DECLARE
声明部分
BEGIN
可执行部分
EXCEPTION
异常处理部分
END;
例:
首先我们看一个简单之例子,下面这个例子是统计从1 ......