Partager via


NVL( ) Function

Returns a non-null value from two expressions.

NVL(eExpression1, eExpression2)

Return Value

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

Parameters

  • 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.

Remarks

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

Example

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
CLEAR
? NVL(.T., glMyNull)  && Displays .T.
? NVL(glMyNull, glMyNull)  && Displays .NULL.

See Also

Reference

ISNULL( ) Function

SET NULL Command

Other Resources

Functions