oracle的substr函数的用法

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'

 

 

 

 

 

 

我转载的这篇文章:

http://www.cnblogs.com/ipusr/archive/2007/03/20/681733.html

posted @ 2011-01-08 22:12  emmy  阅读(112632)  评论(4编辑  收藏  举报