SQL> create table nvl (a int, b int);
表已创建。
SQL> insert into nvl values (1,1);
已创建 1 行。
SQL> insert into nvl values (2,null);
已创建 1 行。
SQL> insert into nvl values (3,3);
已创建 1 行。
SQL> commit;
提交完成。
SQL> select count(nvl(b,0))
2 from nvl where b is null;
COUNT(NVL(B,0))
---------------
1
SQL> select * from nvl where b is null;
A B
---------- ----------
2
SQL> select count(*) from nvl where b is null;
COUNT(*)
----------
1
SQL> select count(b) from nvl wehre b is null;
select count(b) from nvl wehre b is null
*
第 1 行出现错误:
ORA-00933: SQL 命令未正确结束
SQL> select count(b) from nvl wehre b = null;
select count(b) from nvl wehre b = null
*
第 1 行出现错误:
ORA-00933: SQL 命令未正确结束
SQL> select count(distinct b) from nvl wehre b is null;
select count(distinct b) from nvl wehre b is null
*
第 1 行出现错误:
ORA-00933: SQL 命令未正确结束
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14181270/viewspace-1059350/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14181270/viewspace-1059350/