NVL (a,b)
--当a=null时,返回b,否则返回a
NVL2 (a, b, c)
-- 当a=null时,返回c,否则返回b
NULLIF (expr1, expr2)
--当a=b时,返回null,否则返回a
COALESCE (expr1, expr2, ..., exprn)
--从左至右找到第一个不为null的值
SQL> select comm, nvl(comm,0) from emp; COMM NVL(COMM,0)
--------- -----------
0
300.00 300
500.00 500
0
1400.00 1400
0
0
0
0.00 0
0
0
0
0 13 rows selected SQL> select comm, nvl2(comm,111,000) from emp; COMM NVL2(COMM,111,000)
--------- ------------------
0
300.00 111
500.00 111
0
1400.00 111
0
0
0
0.00 111
0
0
0
0 13 rows selected SQL> select nullif('abc','abc'),nullif('abc','') from dual; NULLIF('ABC','ABC') NULLIF('ABC','')
------------------- -------------------
abc SQL> select coalesce(null,null,1,null,2,null) from dual; COALESCE(NULL,NULL,1,NULL,2,NU
------------------------------
1