null与任何值做计算或逻辑比较,结果都为null,并不能得到你要的true或false
begin
if not (null='a') then
dbms_output.put_line('True');
else
dbms_output.put_line('False');
end if;
end;
False
哈哈,俺恰好这两天刚仔细研究了关于null的定义,有位前辈做了很精妙的总结,俺贴出来供参考,如下:~~~
与时
false and false = falsefalse and true = falsefalse and null = false
true and false = false true and true=truetrue and null = null
null and false = false null and true=nullnull and null= null
或时:
false or false = falsefalse or true = truefalse or null = null
true or false = true true and true=truetrue and null = true
null or false = null null or true=truenull or null= null
最初由 fangjinde 发布
[B]null与任何值做计算或逻辑比较,结果都为null,并不能得到你要的true或false
[/B]
Null or True=True
Null and False=False
eg:
SQL> set serveroutput on
SQL> l
1begin
2if (NUll and false) is null then
3 dbms_output.put_line('NUll');
4 elsif (NUll and false) then
5dbms_output.put_line('True');
6 else
7dbms_output.put_line('False');
8end if;
9* end;
SQL> /
False
PL/SQL 祘?抖?ЧΘ.
SQL>