DB2 Version 9.7 for Linux, UNIX, and Windows

ARRAY_PRIOR scalar function

Read syntax diagramSkip visual syntax diagram
>>-ARRAY_PRIOR--(--array-variable--,--array-index--)-----------><

The schema is SYSIBM.

The ARRAY_PRIOR function returns the next smaller array index value for an array relative to the specified array index argument.

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.
array-index
Specifies a value that is assignable to the data type of the index of the array. Valid values include any valid value for the data type.

The result is the next smaller array index value defined in the array relative to the specified array-index value. If array-index is greater than the maximum index array value in the array, the result is the last array index value defined in the array.

The data type of the result of the function is the data type the array index. The result can be null; if either argument is null, the cardinality of the first argument is zero, or the value of array-index is less than or equal to the value of the first index in the array, the result is the null value.

Examples