ITPub博客

首页 > 数据库 > Oracle > nvl

nvl

原创 Oracle 作者:13175 时间:2012-09-06 10:51:49 0 删除 编辑

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 命令未正确结束

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14181270/viewspace-1059350/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: MERGE
下一篇: ORDER BY
请登录后发表评论 登录
全部评论

注册时间:2012-02-22

  • 博文量
    52
  • 访问量
    224920