select substr('abcdefg',3,2) from dual; 返回:cd说明: SUBSTR(char, m [, n]) Returns a portion of Char, beginning at character M, N characters long. If M is positive, Oracle counts from the beginning of Char to find the first character. if M is negative, Oracle counts backwards from the end of Char. If N is omitted, Oracle returns all characters to the end of Char.
返回:cd说明:
SUBSTR(char, m [, n])
Returns a portion of Char, beginning at character M, N characters long.
If M is positive, Oracle counts from the beginning of Char to find the first character.
if M is negative, Oracle counts backwards from the end of Char.
If N is omitted, Oracle returns all characters to the end of Char.
1.origin string
2.切割开始点(负数代表从末尾开始数起,最后一个为-1)
3.切割数量(若未指明参数,则切割到结束,可选)
select substr('abcdefg',2) from dual; -bcdefg
select substr('abcdefg',2,3) from dual; -bcd
select substr('abcdefg',-4,3) from dual; -def
substring substr
INSTR('ORAORASQL ARARA','RA') ・・・2检索第四个字符后面的第二个'RA'
INSTR('ORAORASQL ARARA','RA',4,2) ・・・12检索后面第五个字符以前的'RA'
INSTR('ORAORASQL ARARA','RA',-5,1) ・・・5