--First select substr (' 1233***6795 ', 0, (Select InStr (' 1233***6795 ', ' * * * ', 1, 1) from dual)-1) from dual;--the second segment select SUBSTR ( ' 1233***6795 ', ((Select InStr (' 1233***6795 ', ' * * * ', 1, 1) from dual) + 3), (select Length (' 1233***6795 ') from dual)] from Dua L Select InStr (' 1233***6795 ', ' * * * ', 1, 1) from dual 1.SUBSTR (String,start_position,[length]) to substring, return string
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) finds the string position 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 returned result is LENGTHB (string) to calculate the byte length of string: Returns the length of the string in bytes (string) Calculates the character length of a string: Returns the length of the strings, in characters
SQL: Stitching strings, intercepting strings, taking string lengths