Retrieving array values using an index
Retrieving array element values can be done directly by referencing the array and specifying a sub-index value.
Before you begin
- Read: Ordinary array data type
- Read: Restrictions on the array data type
- Privileges required to execute the SET statement or any SQL statement that contains the array reference
About this task
Procedure
Example
SET mylocalVar = myArray[1];
What to do next
If the SET statement executes successfully, the local variable should contain the array element value.
If the SET
statement failed to execute successfully:
- Verify the SQL statement syntax of the SET statement and execute the statement again.
- Verify that the variable is of the same data type as the array element.
- Verify that the array was created successfully and currently exists.