ARRAY_MAX_CARDINALITY
ARRAY_MAX_CARDINALITY is a predefined constant in SQL standards that denotes the maximum number of elements an array can have. Its value depends on the SQL implementation and may vary.
Example
Output
Explanation
The ARRAY_MAX_CARDINALITY attribute is used to limit the size of a collection. In the example, a PL/SQL block declares a type t_numbers
as a table of numbers, limiting its size to 5 elements. The named block then outputs the limit of the collection, which shows as “5”.
Example
Output
Explanation
The ARRAY_MAX_CARDINALITY
function returns the maximum number of elements that any array can contain. The example finds the maximum cardinality for an array of a custom type complex
, which consists of two elements - an INTEGER and a REAL number. The output 2
implies that the array contains two elements.