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.
Example
Section titled “Example”SELECT INSTR2('Hello World','o') AS LocationFROM dual;Output
Section titled “Output”LOCATION---------- 5Explanation
Section titled “Explanation”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.