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.