Get started
Load & manage data
Work with data
Administration
Reference & resources
Updated Sep 29, 2023
Send us feedback
array_position
Applies to: Databricks SQL Databricks Runtime
Returns the position of the first occurrence of element in array.
element
array
array_position(array, element)
array: An ARRAY with comparable elements.
element: An expression matching the types of the elements in array.
A long type.
Array indexing starts at 1. If the element value is NULL, a NULL is returned.
> SELECT array_position(array(3, 2, 1, 4, 1), 1); 3 > SELECT array_position(array(3, NULL, 1), NULL) NULL
[ ] (bracket sign) operator
array_contains function
arrays_overlap function