DB2 Version 9.7 for Linux, UNIX, and Windows

ARRAY element specification

Read syntax diagramSkip visual syntax diagram
array-element-specification

                    (1)                              
|--+-array-variable------------------------------+-------------->
   '-CAST--(--parameter-marker--AS--data-type--)-'   

>--[--expression--]---------------------------------------------|

Notes:
  1. If the data type of the elements in the array is a row type, then the syntax represents an array-element-specification with a row data type and can only be used where a row-expression is allowed.
The ARRAY element specification returns the element from an array specified by expression. If any argument to expression is null, the null value is returned.
array-variable
An SQL variable, SQL parameter, or global variable of an array type.
CAST (parameter-marker AS data-type)
A parameter marker is normally considered to be an expression, but in this case it must explicitly be cast to a user-defined array data type.
[expression]
Specifies the array index of the element that is to be extracted from the array. The array index of an ordinary array must be assignable to INTEGER (SQLSTATE 428H1); its value must be between 1 and the cardinality of the array (SQLSTATE 2202E). The array index of an associative array must be assignable to the index data type (SQLSTATE 428H1).