Reference Guide > TDV Support for SQL Functions > Array SQL Script Functions > FIND_INDEX
 
FIND_INDEX
The function searches a vector for the first occurrence of a specified value. It accepts two arguments. The first argument is any scalar value. The second argument is the vector that is searched. The index starts at 1.
The base type of the vector and the supplied argument’s data type must be comparable or implicitly castable.
If the searched value is not found in the vector, the result is zero.
If either the vector or the supplied argument is NULL, the result of the function is NULL.
The following example returns a value of 3:
DECLARE v VECTOR(INT) DEFAULT VECTOR [5, 10, 50, 100];
SET i = FIND_INDEX(50, v);
Refer to the TDV Reference Guide Chapter TDV SQL Script for more information about Vectors and Functions.