首页 > 代码库 > oracle exist 语句

oracle exist 语句

EXISTS里的子查询结果集非空,EXISTS()子句的值就是true。 
EXISTS里的子查询结果集为空,EXISTS()子句的值就是false。 

NOT EXISTS里的子查询结果为非空,NOT EXISTS()字句的值是false

NOT EXISTS里的子查询结果为为空,NOT EXISTS()字句的值是true

 

例如:

select * from emp where not exists (select * from emp a where a.empno = 1131001 );

能查到结果集

select * from emp where exists (select * from emp a where a.empno = 11001 );

能查到结果集 

结论 not exitst 子句为空 能查询到结果集 等价于 exist  子句非空

 

 

 

 

 

 

转自:http://yangzhonglei.iteye.com/blog/699673 

感谢分享

oracle exist 语句