Oracle截取字符串的函數substr

Oracle截取字符串的函數substr

substroracle

  Oracle中的截取字符串函數。函數

  語法以下:spa

  substr( string, start_position, [ length ] )orm

  參數分析:字符串

  stringget

  字符串值string

  start_positionit

  截取字符串的初始位置, Number型,start_position爲負數時,表示從字符串右邊數起。io

  lengthtest

  截取位數,Number型

  其中,length爲可選,若是length爲空(即不填)則返回start_position後面的全部字符。

  意思就是:

  從start_position開始,取出length個字符並返回取出的字符串。

  具體參考示例。

  示例:

  SELECT substr('This is a test', 6, 2) FROM dual 返回 'is'

  substr('SyranMo have a dream', -8, 2)

相關文章
相關標籤/搜索