Function IsNull() Foundation

Tests if an expression evaluates to NULL/NIL.

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

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.


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.


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.