MAX_CARDINALITY
The MAX_CARDINALITY function returns a value representing the maximum number of elements an array can contain. This is the cardinality specified on the CREATE TYPE (Array) statement for the user-defined array type.
- array-expression
- The expression can be either an SQL procedure variable or parameter of an array data type, or a cast specification of a parameter marker to an array data type.
The result of the function is BIGINT. The result cannot be null.
Example
Assume that type PHONE_LIST is defined as:
CREATE TYPE PHONE_LIST AS INTEGER ARRAY[100]
The
array NUMBERS is of type PHONE_LIST. The following SET statement assigns
variable CARD the value 100, in accordance with the definition of
PHONE_LIST:SET CARD = MAX_CARDINALITY(NUMBERS);