Hitachi

Hitachi Advanced Database SQL Reference


6.7 Null value

The null value is a special value indicating that either no value exists or no value has been set. The null value is set in any area that does not contain values or in which values have not been set. The following explains how the null value is handled.

Receiving a column value as a result of a retrieval
  • If you are using the JDBC driver

    Determine whether the column value that was obtained is the null value using the wasNull method in the ResultSet interface.

  • If you are using the ODBC driver

    When the value of a column of retrieval results is the null value, the StrLen_or_IndPtr argument of SQLBindCol or SQLGetData is set to SQL_NULL_DATA.

  • If you are using CLI functions

    Use indicators to identify null values. For details, see a_rdb_SQLInd_t (indicator) in the HADB Application Development Guide.

Comparison

The predicate is undefined for rows in which the result of a value expression other than the following is a null value, or for rows in which the column value is a null value:

  • A value expression on the left side of the NULL predicate

  • A value expression specified in ESCAPE escape-character in the LIKE predicate

For details about how the scalar function DECODE handles comparisons to the null value, see 8.15.1 DECODE.

Sorting

The null value is sorted according to the specification of the null-value sort order in the sort specification list. For details about the specification of the null-value sort order, see 7.24.1 Specification format for the sort specification list.

Grouping

In the grouping condition columns, if a row contains null values, any SQL statement that performs grouping will treat the null values as being the same value.

Exclusion of duplicates

Multiple null values are treated as duplicates.

Set functions

In general, set functions ignore the null value. The COUNT(*) function, however, calculates all eligible rows, regardless of null values that might be present in the rows.

Window functions

In window functions, when there are rows where the results of a value expression specified for the window specification are null values, the null values are treated as being the same value.

Indexing

An index can be defined for a column that contains null values.