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'

發佈了33 篇原創文章 · 獲贊 10 · 訪問量 11萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章