Example:
Select substr (Largetext,instr (Largetext, ' a ', ") +11,instr (Largetext, ' B ',)-instr (Largetext, ' a '," -11) "as Cutstr
From table name where id= ' 123456789 '
and InStr (Largetext, ' B ', <>0;)
1.instr
Returns the position of the string to intercept in the source string, separating the common functions from the string.
InStr (string1, string2, start_position,nth_appearance)
| string1 |
source string to find in this string. |
| string2 |
The string to find in string1. |
| start_position |
represents where string1 is starting to find. This parameter is optional if omitted by default to 1. The string index starts at 1. If this parameter is positive, it is retrieved from left to right, and if this parameter is negative, right-to-left, returns the starting index of the string to find in the source string. |
| nth_appearance |
represents the string2 to find the first occurrence. This parameter is optional, If omitted, the default is 1. If negative, the system will give an error. |
2.substr
SUBSTR (string, intercept start position, intercept length)//return intercepted word
substr (' Hello World ', 0, 1)//return result is ' H ' * start with a string of length 1 from the first character
substr (' Hello World ', 1, 1)//Returns the result for ' H ' *0 and 1 is the first character that represents the start position of the Intercept
substr (' Hello world ', 2,4)//return result as ' Ello '
substr (' Hello world ', -3,3)//Returns the result as ' rld ' * negative (-i) to indicate the start of the intercept is the left number I character of the right end of the string
Test:
Select substr (' Hello world ', -3,3) value from dual
3.and InStr (Largetext, ' </CARRIERID> ') <>0; judged to have a string
Oracle reads the corresponding fields from the XML file in the database table