POSITION

All functions > STRING > POSITION

Returns the position of the first occurrence of a substring within a string.

Syntax

POSITION(expr, search)
sql

Arguments

ParameterTypeRequiredDescription
substringVARCHARYesSubstring to search for
stringVARCHARYesString 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

Examples

Last update at: 2025/10/13 10:23:46