Null values in host variables
A null value represents unknown or not applicable values. This value is distinct from all legal values in any given data type.
The representation of null values depends on both the computer and the data type. Often, the representation does not correspond to a legal value for the C data type. Do not attempt to perform arithmetic or other operations on a host variable that contains a null value.
A program must, therefore, have some way to recognize a null value.
To handle null values, provides the following
features:
- The risnull() and rsetnull() library functions enable you to test whether a host variable contains a null value and to set a host variable to a null value.
- Indicator variables are special variables that
you can associate with host variables that hold values for database
columns that allow null values.
The value of the indicator variable can show whether the associated host variable contains a null value.
In an ANSI-compliant database, a host variable that is used in an INSERT statement or in the WHERE clause of any SQL statement must be null terminated.