POSITION
All functions > STRING > POSITION
Returns the position of the first occurrence of a substring within a string.
Syntax
POSITION(expr, search)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
substring | VARCHAR | Yes | Substring to search for |
string | VARCHAR | Yes | String to search in |
Returns
Position of first occurrence (1-indexed), or 0 if not found
Notes
- Position is 1-indexed (first character is position 1)
- Returns 0 if substring is not found
- Case-sensitive search
- See also: STRPOS