NULL as a Parameter

Passing a null value as a parameter affects the behavior of many commands and functions in Visual FoxPro. The following general rules apply to null values passed to commands and functions:

  • Commands generate errors when passed a null value.

  • Functions that accept .NULL. as a valid value propagate .NULL. to the result.

  • Functions that accept parameters that could be numeric values generate an error if you supply .NULL. for those parameters.

    STORE .NULL. TO n
    USE Mytable ALIAS &n            && Expected a workarea 
                                  && name or number
    ? SUBSTR("Hello, world",n,5)   && Expected a position
                                  && in the string
    
  • ISBLANK( ), ISDIGIT( ), ISLOWER( ), ISUPPER( ), ISALPHA( ), and EMPTY return false (.F.) when passed a null value. ISNULL( ) returns true (.T.) when passed a null value.

  • The commands INSERT - SQL and SELECT - SQL process null values through the IS NULL and IS NOT NULL clauses and, in the case of INSERT, UPDATE, and REPLACE, place null values into records.

  • SQL Aggregate functions ignore instead of propagate null values.

  • Visual FoxPro aggregate functions only propagate .NULL. if all supplied values are null values; otherwise, any null value is ignored.

For more information on using null values in your application, see Working with Tables.

See Also

EMPTY( ) Function | INSERT - SQL Command | ISALPHA( ) Function | ISBLANK( ) Function | ISDIGIT( ) Function | ISLOWER( ) Function | ISNULL( ) Function | ISUPPER( ) Function | REPLACE Command | SELECT - SQL Command | SQL Commands Overview | UPDATE Command | Null Value Handling | Data Manipulation | NULL as a Value