NULL指的是空值,或者非法值。
NVL (expr1, expr2)->expr1为NULL,返回expr2;不为NULL,返回expr1。注意两者的类型要一致
NVL2 (expr1, expr2, expr3) ->expr1不为NULL,返回expr2;为NULL,返回expr3。expr2和expr3类型不同的话,expr3会转换为expr2的类型
select t.empno,nvl2(t.mgr,'the value is not null','the value is null') from emp t where t.deptno in (select s.deptno from dept s where s.deptno='1')
NULLIF (expr1, expr2) ->相等返回NULL,不等返回expr1
select t.empno,nullif(t.mgr,'tom') from emp t where t.deptno in (select s.deptno from dept s where s.deptno='1')