NVL( ) Function

Returns a non-null value from two expressions.

NVL(eExpression1, eExpression2)


eExpression1, eExpression2

NVL( ) returns eExpression2 if eExpression1 evaluates to a null value. NVL( ) returns eExpression1 if eExpression1 is not a null value. eExpression1 and eExpression2 may be any data type. NVL( ) returns .NULL. if both eExpression1 and eExpression2 both evaluate to the null value.

Character, Date, DateTime, Numeric, Currency, Logical, or the null value

Use NVL( ) to remove null values from calculations or operations where null values are not supported or are not relevant.

The following example creates a memory variable named glMyNull that contains the null value. NVL( ) is used to return a non-null value from glMyNull and another expression.

STORE .NULL. TO glMyNull  && A memory variable containing the null value
? NVL(.T., glMyNull)  && Displays .T.
? NVL(glMyNull, glMyNull)  && Displays .NULL.

Community Additions