15.00 - Recommended Null Handling Technique For UDT Columns - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1184-015K

Recommended Null Handling Technique For UDT Columns

If you intend to support null attributes or if you write a map ordering routine that can return nulls, then any CREATE TABLE or ALTER TABLE statements that specify that type should specify the NOT NULL attribute for that UDT column.

If nulls are permitted in the column and either the map ordering routine or the system‑generated observer method for the UDT can return nulls, the results returned for identical requests can vary 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 specify the NOT NULL attribute for UDT columns, then the following objects may 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);