1.nvl(exp1,exp2)
NVL
lets you replace null (returned as a blank) with a string in the results of a query. If expr1
is null, then NVL
returns expr2
. If expr1
is not null, then NVL
returnsexpr1
.
該函數是處理表達式中的空值:假設表達式exp1是空值,則該函數返回表達式exp2的值,
假設表達式exp1沒有是空值,則該函數返回表達式exp1的值。
2.nvl2(exp1,exp2,exp3)
NVL2
lets you determine the value returned by a query based on whether a specified expression is null or not null. If expr1
is not null, then NVL2
returns expr2
. Ifexpr1
is null, then NVL2
returns expr3
.
該函數決意exp1離去是空值和非空值時返回哪個表達式:
假設exp1為空值,則返回exp3
假設exp1非空,返回exp2。
3.coalesce(exp1,exp2,.....)
COALESCE
returns the first non-null expr
in the expression list. You must specify at least two expressions. If all occurrences of expr
evaluate to null, then the function returns null.
該函數正在括號里全數的表達式中返回第一個非空值,假設都是空值,則返回空值,表達式最少是兩個。