This article briefly introduces the usage of oracle's instr functions, which is equivalent to the search function in SQL. If you need it, you can refer to it.
This article briefly introduces the usage of oracle's instr functions, which is equivalent to the search function in SQL. If you need it, you can refer to it.
This article briefly introduces the usage of oracle's instr functions, which is equivalent to the search function in SQL. If you need it, you can refer to it.
Syntax
The Code is as follows: |
|
Instr (string1, string2 [, start_position [, nth_appearance]) |
String1 is the string to be searched.
String2 is the search substring in string1.
Start_position is the start position of the search in string1. This parameter is optional. If omitted, the default value is 1. The first position in the string is 1. If start_position is a negative number, the function searches for strings starting from string1, and then returns start_position to the number of characters in the ending count.
The Nth appearance of nth_appearance string2. This is optional. If omitted, the default value is 1.
Note:
If string2 is found in string1, then the INSTR Oracle function returns 0.
Applies:
The Code is as follows: |
|
Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g |
Instance
The Code is as follows: |
|
Instr ('tech on the net', 'E') wocould return 2; the first occurrence of 'E' Instr ('tech on the net', 'E', 1, 1) wocould return 2; the first occurrence of 'E' Instr ('tech on the net', 'E', 1, 2) wocould return 11; the second occurrence of 'E' Instr ('tech on the net', 'E', 1, 3) wocould return 14; the third occurrence of 'E' Instr ('tech on the net', 'E',-3, 2) wowould return 2. |