Grammar
The code is as follows |
Copy Code |
InStr (string1, string2 [, Start_position [, Nth_appearance]]) |
String1 is the string to search for.
string2 searches for substrings in string1.
Start_position is where the search will begin in string1. This parameter is optional. If omitted, the default is 1. The first position in the string is 1. If the start_position is a negative number, the function searches for the string from the beginning of the string1, and then start_position the characters for the end count.
Nth_appearance string2 's nth appearance. This is optional. If omitted, the default is 1.
Attention:
If string2 is found in string1, then the InStr Oracle function returns 0.
Applies To:
The code is as follows |
Copy Code |
Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g |
Instance
code is as follows |
copy code |
instr (' Tech on The net ', ' E ') would return 2; The "occurrence" of ' E ' InStr (' Tech on ', ' E ', 1, 1) would return 2; the ' E ' Occurrence R (' Tech on the net ', ' e ', 1, 2) would return 11; The second occurrence of ' E ' InStr (' Tech on ", ' E ', 1, 3) would return;" Third occurrence of ' e ' in STR (' Tech on the net ', ' e ', -3, 2) would return 2. |