substr(string,start,length)
參數 | 必須 | 參數說明 |
string | 必須 | 指定的要截取的字符串 |
start | 必須 |
規定在字符串的何處開始: 正數 - 在字符串的指定位置開始 負數 - 在從字符串結尾的指定位置開始 0 - 在字符串中的第一個字符處開始 |
length | 可選 | 指定要截取的字符串長度,缺省時返回字符表達式的值結束前的全部字符 |
例如:
select substr('abcdefg',3,4) from dual;結果是cdef
select substr('abcdefg',-3,4) from dual;結果efg
select substr('abcde',2),substr('abcde',-2),substr('abcde',2,3),substr('abcdewww',-7,3) from dual;
結果是bcde、de、bcd、bcd