oracle substr_instr提取以/分隔之後一個/之後的內容

wisdomone1發表於2013-04-23

SQL> select * from t_instr;
 
A
--------------------------------------------------------------------------------
/tymh_images/jc/termSpec/1366181827897iphone520121207144335793_2471.jpg
/tymh_images/jc/termSpec/aaaa520121207144335793_2471.jpg
/x/y/sbc/123.jpg
 
SQL> select a,substr(a,length(a)-instr(reverse(a),'/',1)+2) from t_instr;
 
A                                                                                SUBSTR(A,LENGTH(A)-INSTR(REVER
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
/tymh_images/jc/termSpec/1366181827897iphone520121207144335793_2471.jpg          1366181827897iphone520121207144335793_2471.jpg
/tymh_images/jc/termSpec/aaaa520121207144335793_2471.jpg                         aaaa520121207144335793_2471.jpg
/x/y/sbc/123.jpg                                                                 123.jpg
 
SQL>

 

小結:1,reverse

          2,instr

          3,length

          4,substr

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-759099/,如需轉載,請註明出處,否則將追究法律責任。

相關文章