Previous Topic: How SQL Processes Host VariablesNext Topic: SELECT Statement—Request Data from a Table


How SQL Processes Null Values

Standard SQL explicitly defines a null state for column values. This means that there may be no data value set for a column. A null column value for SQL is not the same as it would be for TSO/E REXX or a CLIST.

When a null table column is displayed, a four-byte NULL string is shown or represented in the variables.

When setting a column to a null value (that is, a zero length value), do not use a host variable. Rather, use the value NULL.

For example, to set a null column value in SQL, you could invoke the SQL UPDATE statement from a rule or an OPS/REXX program as follows:

ADDRESS SQL
  "UPDATE tablename SET colname = NULL..."

When SQL returns a null column value to CA OPS/MVS, it does so by returning a zero-length text string. This means that a null value looks just like an SQL column value that is of zero length. In SQL comparative expressions, though, a null column value is equivalent only to another null column value.