When working with nulls, you can avoid some common mistakes by keeping in mind the following rules: Comparisons involving nulls always yield NULL Applying the logical operator NOT to a null yields NULL In conditional control statements, if the condition yields NULL, its associated sequence of statements is not executed If the expression in a simple CASE statement or CASE expression yields NULL, it cannot be matched by using WHEN NULL. In this case, you would need to use the searched case syntax and test WHEN expression IS NULL. PL/SQL treats any zero-length string like a null. This includes values returned by character functions and Boolean expressions.
你可以对lx字段用nvl()函数来设定一个很长的奇怪的字符串,不就okle
select id,jh from tablename where id=988 and lx='AA' ,看看是什么结果
Applying the logical operator NOT to a null yields NULL
In conditional control statements, if the condition yields NULL, its associated
sequence of statements is not executed If the expression in a simple CASE statement or CASE expression yields NULL, it
cannot be matched by using WHEN NULL. In this case, you would need to use
the searched case syntax and test WHEN expression IS NULL.
PL/SQL treats any zero-length string like a null. This includes values returned by
character functions and Boolean expressions.
其实我的理解是这样的:空值---不是任何值;
既然不是任何值,那么它就一定不是'AA'
既然不是'AA',那么lx<>'AA' 就应该成立
既然成立,数据集里就应该包括这一行。
看来,所有的NULL值并不参与判断。
null应该理解成不等于任何值
oracle提供一些方法来处理null值的问题.比例:nvl(),nvl2(),is null ,is not null等.
================================对呀,既然它不等于任何值,那么它不等于AA不就应该成立吗?
我觉得在这方面,SQL语言应该和平常的程序语言一致,因为我们平时在程序中判断NULL<>'AA'是成立的。
http://community.csdn.net/Expert/topic/3141/3141492.xml?temp=.2455408