码迷,mamicode.com
首页 > 其他好文 > 详细

字符串

时间:2014-10-16 18:47:22      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:dba   sql   数据库   oracle   select   

截取字符串的函数:
          
      
 select
       ‘12345sda‘,
       decode(‘12345sda‘,‘MM SP‘,null,nvl(substr(‘12345sda‘,0,instr(‘12345sda‘,‘-‘,1)-1),‘12345sda‘)),
       decode(‘12345sda‘,‘MM SP‘,‘12345sda‘,substr(‘12345sda‘,        decode(instr(‘12345sda‘,‘-‘,1),0,null,instr(‘12345sda‘,‘-‘,1)) - length(‘12345sda‘))),
      
       ‘12345 - orgtest1‘,
       decode(‘12345 - orgtest1‘,‘MM SP‘,null,nvl(substr(‘12345 - orgtest1‘,0,instr(‘12345 - orgtest1‘,‘-‘,1)-1),‘12345 - orgtest1‘)),
       decode(‘12345 - orgtest1‘,‘MM SP‘,‘12345 - orgtest1‘,substr(‘12345 - orgtest1‘,        decode(instr(‘12345 - orgtest1‘,‘-‘,1),0,null,instr(‘12345 - orgtest1‘,‘-‘,1)) - length(‘12345 - orgtest1‘))),
      
       ‘MM SP‘,
       decode(‘MM SP‘,‘MM SP‘,null,nvl(substr(‘MM SP‘,0,instr(‘MM SP‘,‘-‘,1)-1),‘MM SP‘)),
       decode(‘MM SP‘,‘MM SP‘,‘MM SP‘,substr(‘MM SP‘,        decode(instr(‘MM SP‘,‘-‘,1),0,null,instr(‘MM SP‘,‘-‘,1)) - length(‘MM SP‘)))
 from dual;

字符串

标签:dba   sql   数据库   oracle   select   

原文地址:http://blog.csdn.net/jenya007/article/details/40151035

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!