Oracle 检查列值是否为null

Oracle 检查数据库列值是否为null


方法1、IS NULL

expr1 IS [NOT] NULL数据库

SELECT *
  FROM emp t
WHERE t.comm IS NULL;函数

不知道为何当 用Case expr1 is null then 0 这种方法来对列值为null的值处理的时候,老是有一部分 null 不会作处理。spa

方法2、NVL(expr1, expr2) 函数

若是expr1 为null,将会用expr2替代。方法

If expr1 contains a NULL value, then return expr3. If the value of expr1 contains a non-NULL
value, then return expr2.数据

Examples:
NVL2(‘A’,’B’,’C’) results in B
NVL2(NULL,’B’,’C’) results in C
NVL2(1,2,3) results in 2
NVL2(NULL,2,3) results in 3co

相关文章
相关标签/搜索