ARRAY element specification

The ARRAY element specification returns the element from an array specified by expression.

Read syntax diagramSkip visual syntax diagram array-variableCAST(parameter-markerASarray-type) [expression]
array-variable
Specifies a variable or parameter of type array in an SQL procedure or SQL function.
CAST(parameter-marker AS array-type)
Specifies the array data type to be used for the parameter marker. The array data type passed for the parameter marker value must match this array data type exactly.
[expression]
Specifies the array index of the element that is to be extracted from the array. The array index must return a value that is an exact numeric with zero scale or DECFLOAT. Its value must be between 1 and the cardinality of the array.

The data type of the result is the data type specified for the array on the CREATE TYPE (Array) statement.

If expression is null or the array is null, the null value is returned.