Function IsNull() Foundation

Tests if an expression evaluates to NULL/NIL.

Syntax
IsNull( <Expression> ) --> lIsNull
IsNull( <Expression> , <ReplacementValue> ) --> xValue
Parameters
<Expression>
Specifies the expression to be evaluated.
<ReplacementValue>
If <Expression> evaluates to NULL/NIL, <ReplacementValue> is the value returned. <ReplacementValue> must have the same type as <Expression>.
Return

If IsNull() is called with a single parameter, IsNull() returns .T. (true) if an expression evaluates to a NULL/NIL value; otherwise, IsNull( ) returns .F. (false).

If the parameter <ReplacementValue> is passed, the function IsNull() returns the value of <ReplacementValue> if <Expression> evaluates to NULL/NIL. Otherwise the value of <Expression> is returned.

Description

The function IsNull() should be used instead of an explicit comparison with NIL wherever <Expression> is related to database operations. Using IsNull() instead of <Expression> != NIL helps to keep business logic independent of the underlying database management system due to the fact that all major DBMS vendors support IsNull().

The NULL/NIL value indicates that the variable contains no valid data. NULL/NIL is not the same as Empty(). It is also not the same as a zero-length string (""), which sometimes is referred to as a null string.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.