Oracle substr函数用法

来源:互联网 发布:澳洲留学体验 知乎 编辑:程序博客网 时间:2024/05/21 10:29

查看原文:http://www.ibloger.net/article/254.html

oracle的substr函数的用法
 取得字符串中指定起始位置和长度的字符串   substr( string, start_position, 
[ length ] )
 如:
     substr(
'This is a test'62)     would return 'is'
     substr(
'This is a test'6)     would return 'is a test'
     substr(
'TechOnTheNet'-33)     would return 'Net'
     substr(
'TechOnTheNet'-63)     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'

 

1 0
原创粉丝点击