Recommended Null Handling Technique For UDT Columns - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
jbg1472252759029
lifecycle
latest
Product Category
Teradata Vantage™

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);