ARRAY_POSITION

All functions > ARRAY > ARRAY_POSITION

Returns the 1-based position of the first occurrence of an element in an array.

Syntax

ARRAY_POSITION(array, element)
sql

Arguments

ParameterTypeRequiredDescription
arrayARRAYBIGINTYesThe array to search in
elementBIGINTYesThe element to find in the array

Returns

The 1-based position of the first occurrence, or NULL if not found

Notes

  • Returns 1-based index (SQL standard)
  • Finds only the first occurrence of the element
  • Returns NULL if element is not found in the array
  • Performs exact match comparison (case-sensitive for strings)
  • Can find NULL values in arrays

Examples

Last update at: 2025/10/13 10:23:46