Usage Notes | ARRAY_COUNT_DISTINCT | Teradata Vantage - Usage Notes - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zsn1556242031050.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢
ARRAY_COUNT_DISTINCT takes an array expression as an argument and returns a value that represents one of two possible outputs:
  • If you specify the optional argument matching_expr, then the function returns the number of elements in array_expr whose values are equal to matching_expr. If matching_expr is NULL, the function returns the number of elements with NULLs.
  • If you do not specify matching_expr, then the function returns the number of distinct elements in array_expr. If a NULL element is encountered in the array argument, it is ignored and not considered when doing the calculation.

If you specify a scope reference, the function is applied only to the elements within the limits of the given scope. You can use ARRAY_COUNT_DISTINCT with arrays of numeric as well as character element types.

If the array argument contains any elements that are in an uninitialized state, an error is returned. Use a scope reference to avoid referencing a range of the array with uninitialized elements, or set any uninitialized elements to NULL. You can do this with the OEXTEND method. See OEXTEND.

If array_expr is NULL, the function returns NULL.