INSTRC Function in PL/SQL
INSTRC function finds Location of a string, within another string, in Unicode complete characters.INSTRC calculates lengths using Unicode complete characters.
<strong>Synatx For using INSTRC function </strong>
INSTRC(string_1, string_2 [, starting_position [, nth_appearance ] ] )
string_1 is the string to search.
string_2 is the substring to search for in string_1.
starting_position is the position in string_1 where the search will start. thisĀ field is optional. If omitted, it defaults to 1. The first position in the string is 1. If the starting_position is negative, the function count from back start_position number of characters from the end of string1 and then searches towards the beginning of string1.
nth_appearance is the nth appearance of string2. This argument is optional. If omitted, it defaults to 1.
If string_2 is not found in string_1, then the instr function will return 0.
some examples follow
SQL>SELECT INSTRC(‘John Peter’, ‘n’, 1, 1)
FROM dual;
This query would return 4; the first occurrence of ‘n’