oracle数据库的substr方法 各种参数的意思。

2022-08-01 教育 62阅读
取得字符串中指定起始位置和长度的字符串
substr( string, start_pos, [ length ] )

如:
substr('This is a test', 6, 2) would return 'is'
substr('This is a test', 6) would return 'is a test'
substr('TechOnTheNet', -3, 3) would return 'Net'
substr('TechOnTheNet', -6, 3) would return 'The'
select substr('Thisisatest', -4, 2) value from dual 结果是 te
select substr('emros',-3,1) value from dual 结果是 r

substr('abcde',-6) = null
substr('abcde',-5) = 'abcde'
substr('abcde',-4) = 'bcde'
substr('abcde',-3) = 'cde'
substr('abcde',-2) = 'de'
substr('abcde',-1) = 'e'
substr('abcde',-0) = 'abcde'
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com