The Oracle Intercept character (SUBSTR), which retrieves the character position (instr), when the then else End statement uses the favorite
Common functions: Substr and InStr
1.SUBSTR (String,start_position,[length]) to substring, return string
Explanation: String meta strings
Start_position start position (starting from 0)
Length optional, number of substrings
For example:
substr ("ABCDEFG", 0); return: ABCDEFG, intercept all characters
substr ("ABCDEFG", 2); return: CDEFG, intercept all characters after starting with C
substr ("ABCDEFG", 0, 3); return: ABC, intercept starting from a 3 characters
substr ("ABCDEFG", 0, 100); Return: abcdefg,100 The maximum number of preprocessed strings is returned, although it exceeds the length of the preprocessed string, but does not affect the return result.
substr ("ABCDEFG",-3); Return: EFG, note parameter-3, a negative value indicates that the string is not changed from the beginning of the tail.
2.INSTR (string,substring,position,ocurrence) Find string position
Explanation: string: source string
SubString: substring to find
Position: Where to find start
Ocurrence: A substring of the first occurrence of a source string
For example:
INSTR (' CORPORATE floor ', ' or ', 3, 2), the source string is ' CORPORATE floor ', the target string is ' OR ', the starting position is 3, the position of the 2nd match is taken, and the return result is 14 '
To test a field instance:
Table: cheyang.content= ' request= "" packid= "" packplanid= "100003624470" sflag= "1" '
Requirement: Intercept Packplanid's Vlaue value
Select substr (Planid, 0, InStr (Planid, ' "', 1, 1)-1) Planid--planid (100003624470" sflag=) intercept "before the string
Into V_packplanid
From (Select substr (content,instr (content, ' Packplanid ', 1, 1) + 11+1,20) Planid--packplanid= length is 11+1 (1), 20 characters are truncated backwards
From Sducy.cheyang
where t.oid = v_oid);
Test results:
Planid
100003624470
Oracle intercepts strings and lookup strings, and uses them together to intercept specific characters