DB2 Version 9.7 for Linux, UNIX, and Windows

ARRAY_FIRST scalar function

Read syntax diagramSkip visual syntax diagram
>>-ARRAY_FIRST--(--array-variable--)---------------------------><

The schema is SYSIBM.

The ARRAY_FIRST function returns the minimum array index value of the array.

array-variable
An SQL variable, SQL parameter, or global variable of an array type, or a CAST specification of a parameter marker to an array type.

The data type of the result is the data type of the array index, which is INTEGER for an ordinary array. If array-variable is not null and the cardinality of the array is greater than zero, the value of the result is the minimum array index value, which is 1 for an ordinary array.

The result can be null; if array-variable is null or the cardinality of the array is zero, the result is the null value.

Examples