巷尾的酒吧

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  64 Posts :: 0 Stories :: 5 Comments :: 0 Trackbacks

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'

posted on 2012-10-11 17:49 abing 阅读(204) 评论(0)  编辑  收藏 所属分类: oracle

只有注册用户登录后才能发表评论。


网站导航: