Conditional Scalar Functions

Table 124. Conditional Scalar Functions 

Function

Description

Decode (c,exp,val,exp,val...def)

Compares value of item c to one or more expressions exp, and returns the value val matched to each expression, or a default def.

Example:

decode (region, 'South America','Priority 1', 'Asia','Priority 2','Europe','Priority 3',null)

substitutes priority values for the specified regions and leaves other regions null.

Nvl (exp1,exp2)

Returns exp2 if null, and exp1 otherwise.

Example:

nvl (Phone_No,'Phone_No','Not Recorded') 

returns "Not Recorded" when no telephone number is on record for a customer. if the function is included in a computed item expression, only two parameters are allowed: exp1 and exp2.