General functions are of the following types :
NVL : Converts a null value to an actual value. NVL (exp1, exp2)
.If exp1 is null then the NVL
function returns the value of exp2.
NVL2 : If exp1 is not null, nvl2
returns exp2
, if exp1 is null
, nvl2
returns exp3. The argument exp1
can have any data type. NVL2 (exp1, exp2, exp3)
NULLIF : Compares two expressions and returns null if they are equal or the first expression if they are not equal. NULLIF (exp1, exp2)
COALESCE : Returns the first non-null expression in the expression list. COALESCE (exp1, exp2… expn)
. The advantage of the COALESCE
function over the NVL
function is that the COALESCE
function can take multiple alternative values.
Conditional Expressions : Provide the use of IF-THEN-ELSE
logic within a SQL
statement. Example: CASE
Expression and DECODE
Function.