Retrieving the number of array elements
Retrieving the number of array elements in a simple array can most easily be done by using the CARDINALITY function and retrieving the maximum allowed size of an array can be done using the MAX_CARDINALITY function.
Before you begin
- Read: Ordinary array data type
- Read: Restrictions on the array data type
- Privileges required to execute the SET statement
About this task
Procedure
Results
Example
SET card = CARDINALITY(arrayName);
SET maxcard = MAX_CARDINALITY(arrayName);
What to do next
- Verify the SQL statement syntax of the SET statement and execute the statement again.
- Verify that the local variable is of the integer data type.
- Verify that the array was created successfully and currently exists.