Link Search Menu Expand Document

ARRAY_FIRST_INDEX

Returns the index of the first element in the indicated array for which the given <func> function returns something other than 0. Index counting starts at 1.

The <func> argument must be included.

Syntax

ARRAY_FIRST_INDEX(<func>, <arr>)
Parameter Description
<func> A Lambda function used to check elements in the array.
<arr> The array evaluated by the function.

Example

SELECT
	ARRAY_FIRST_INDEX(x -> x > 2, [ 1, 2, 3, 9 ]) AS res;

Returns: 3