您的位置:首页 > 数据库 > Oracle

oracle的substr函数的用法

2011-01-08 22:12 218 查看
oracle的substr函数的用法
取得字符串中指定起始位置和长度的字符串 substr( string, start_position, [ 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'

我转载的这篇文章:

/article/4972932.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: