Skip to content

INSTR2

INSTR2(string, substring, position, occurrence)

Section titled “INSTR2(string, substring, position, occurrence)”
  • string: The string to search.
  • substring: The substring to search for.
  • position: Optional position to start the search from, defaults to 1.
  • occurrence: Optional occurrence to find, defaults to the first.
SELECT INSTR2('Hello World','o') AS Location
FROM dual;
LOCATION
----------
5

INSTR2 function in Oracle returns the position of the 2nd occurrence of a substring. In the provided example, we look for the position of the ‘o’ letter in the string “Hello World”. As we can see in the output, the position is 5.