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
| Parameter | Type | Required | Description |
|---|---|---|---|
array | ARRAYBIGINT | Yes | The array to search in |
element | BIGINT | Yes | The 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