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

Teradata Vantageā„¢ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)
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.