ARRAY_POSITION
functionsupportedCore SQL functionsReturns the index of the first occurrence of an element in an array.
Syntax
ARRAY_POSITION( <value_expr> , <array> )
Parameters
| Name | Required | Description |
|---|---|---|
value_expr | required | Value to find in array. If array is a semi-structured ARRAY, value_expr must evaluate to a VARIANT. If array is a structured ARRAY, value_expr must evaluate to a type that is comparable to the type of the ARRAY. |
array | required | The ARRAY to search. |
Returns
The function returns an INTEGER specifying the position of value_expr in array.
Usage notes
- The return value is 0-based, not 1-based. In other words, if the value_expr matches the first element in the array, this function returns 0, not 1.
- If the value is not contained in the ARRAY, the function returns NULL.
- If you specify NULL for value_expr, the function returns the position of the first NULL in the array.