Skip to content

INSTR

  • str: This is the string that will be searched. It is the original string where you want to locate the presence of another substring.
  • substr: This is the substring to be found within the str parameter. It is the targeted string that the user wants to identify inside the original string.
SELECT INSTR('Hello World', 'World');
6

In the given example, INSTR('Hello World', 'World') returns the position of the first occurrence of substring ‘World’ in the string ‘Hello World’. The function counts from 1. Hence, the result is 6. If the substring was not found, it would return 0.