position({search_str} IN {source_str})

Returns an integer that indicates the first occurrence of a substring in a given string. If the substring is not found, the function returns 0.

Example

This example returns the position of the substring “der” in the City field.

SELECT City, POSITION('der' IN City) as "Pos"
FROM "Superstore"
LIMIT 5;
City Pos
Henderson 4
Henderson 4
Los Angeles 0
Fort Lauderdale 9
Fort Lauderdale 9