Result Type and Value - Teradata Vantage NewSQL Engine - 16.20

Teradata Vantageā„¢ Data Types and Literals

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

CARDINALITY returns an integer value that represents the number of elements in the ARRAY that currently have assigned values. This count includes elements that are NULL. Since an ARRAY value may have fewer element values assigned than defined for its maximum size n, the CARDINALITY function may return a value that is smaller than n.

The function returns 0 if the array argument is empty (that is, it does not have any elements assigned). If the array argument is NULL, then CARDINALITY returns NULL as the result.

Even though an ARRAY function normally returns an error if any uninitialized elements fall within the range of the specified scope_reference in any of the ARRAY input arguments, an ARRAY expression specified within a CARDINALITY function behaves differently: an explicit scope that includes uninitialized elements is an acceptable input when an ARRAY expression is specified in a CARDINALITY function.