[orcle] oracle截取字符串的函数substr

substr

  Oracle中的截取字符串函数。

  语法如下:

  substr( string, start_position, [ length ] )

  参数分析:

  string

  字符串值

  start_position

  截取字符串的初始位置, Number型,start_position为负数时,表示从字符串右边数起。

  length

  截取位数,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)

原文地址:https://www.cnblogs.com/kentyouyou/p/2945495.html