To support null attributes for structured UDT, ARRAY, VARRAY, Geospatial, or Period columns, or if a UDT, Geospatial, or Period column has a map ordering routine that can return nulls, CREATE TABLE or ALTER TABLE statements that specify that type should specify the NOT NULL attribute for that UDT, ARRAY, VARRAY, Geospatial, or Period column.
If nulls are permitted in the column and either the map ordering routine or the system-generated observer method for the type can return nulls, then a situation exists that is similar to the situation in which queries are executed against a column attributed as NOT CASESPECIFIC. In this situation, for some queries, the results returned for identical requests can be nondeterministic, varying from query to query.
The ordering routine for a UDT determines whether or not column values are equal and also determines the collation order for sort operations.
If you do not follow this recommendation, then it is possible for the following cases to be treated equally:
- A column null.
- A structured type that contains null attributes and whose map or observer routine returns nulls.
Sometimes a column null is returned in the result set and other times the non-null structured type that contains null attributes is returned in the result set.
The following simple example indicates how you should specify the NOT NULL attribute for UDT columns in a table definition.
CREATE TABLE udtTable ( id INTEGER, udtColumn myStructUdtWithNullAttributes NOT NULL);