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] )

Arguments

  • CharacterExpression - search expression
  • CharacterExpression - (second) - Search string, searches from beginning unless startPosition specified
  • startPosition - search begins from this position. Index starts with 1. Returns 0 if string not found.
  • The return type for LOCATE is an integer.
  • </ul> ## Examples ## ```sql SELECT LOCATE(' and ',NAME),name from ORA2."orcl.localdomain".SUJITH.SANSIRI ```