INSTR2

INSTR2 is a function in SQL that returns the numerical position of the second occurrence of a specific substring within a main string. It is often utilized in text manipulation and string comparison tasks.

Example

SELECT INSTR2('Hello World','o') AS Location
FROM dual;

Output

LOCATION
----------
5

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.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.