# LOCATE

If a specified substring is found within a specified search string, LOCATE returns the index at which the substring is found within the search string. If the substring is not found, LOCATE returns 0.

#### Syntax

    LOCATE(CharacterExpression, CharacterExpression [, StartPosition] )

The second CharacterExpression is the search string and is searched from the beginning, unless startPosition is specified, in which case the search begins from position there; the index starts with 1. It returns 0 if the string is not found.

The return type for LOCATE is an integer.

    -- returns 2
    VALUES LOCATE('love', 'clover')

Parent topic: Built-in functions