ARRAY element specification

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-element-specification
Read syntax diagramSkip visual syntax diagramarray-variable1CAST(parameter-markerASarray-type-name)[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.
array-variable
An SQL variable, SQL parameter, or global variable of an array type.
CAST (parameter-marker AS array-type-name)
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). The 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).