字符串

WBOY
WBOY原創
2016-06-07 16:05:011128瀏覽

截取字符串的函数: 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('12345

截取字符串的函数:


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;
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn