Oracle函数substr(str1, pos, [len])


获得子字符串的函数, 参数可选, 没有len的时候从返回从pos未知到字符串尾的子字符串。

这里有个可以指定pos为负数, 位置就是从字符串尾往前pos个字符的位置开始

例如:

select substr(‘abcdefg’, –1) from dual;
则返回结果 : g

select substr(‘abcdefg’, –3, 2) from dual;
返回结果 : ef

相关内容