Returns the index position of the first occurrence of the element in the array (or NULL if not found).

Syntax

INDEX_OF(<array>, <value>)

Parameters

ParameterDescriptionSupported input types
<array>The array to be analyzedARRAY
<value>The element from the array that is to be matchedAny type that corresponds to an element in the array

Return Type

INTEGER

Example

The following example returns the index position of the 5 in the levels array:

SELECT
	INDEX_OF([ 1, 3, 4, 5, 7 ], 5) AS levels;

Returns: 4