+ -
当前位置:首页 → 问答吧 → 为什么2个计算条件的结果都是FALSE?

为什么2个计算条件的结果都是FALSE?

时间:2011-12-20

来源:互联网

SQL> begin
  2 if null>0 then dbms_output.put_line('greater than 0');
  3 end if;
  4 if not (null>0) then dbms_output.put_line('not greater than 0');
  5 end if;
  6 end;
  7 /

PL/SQL 过程已成功完成。

为什么2个计算条件的结果都是FALSE?

作者: owen00sun   发布时间: 2011-12-20

理解NULL:表示值为空,即不确定;不是空字符串;
所以表达式中含有NULL,返回结果均为FALSE

作者: LuiseRADL   发布时间: 2011-12-21

null是不能跟任何值进行比较的。 只能是 is null 或 is not null

作者: huangdh12   发布时间: 2011-12-21

就是这样
引用 2 楼 huangdh12 的回复:
null是不能跟任何值进行比较的。 只能是 is null 或 is not null

作者: yangqm22   发布时间: 2011-12-21

引用 1 楼 luiseradl 的回复:

理解NULL:表示值为空,即不确定;不是空字符串;
所以表达式中含有NULL,返回结果均为FALSE

+1

作者: funfenffun   发布时间: 2011-12-21

null only compare with 
is null
is not null

作者: cutebear2008   发布时间: 2011-12-21