create table zylemp (
ename varchar2(50))
insert into zylemp values(『中國』);
insert into zylemp values(『中國/湖北』);
insert into zylemp values(『中國/湖北/黃岡』);
insert into zylemp values(『中國/湖北/黃岡/武穴』);
select * from zylemp
select substr(ename,1,case when instr(ename,』/』,1,1)>0 then instr(ename,』/』,1,1)-1else 10 end )as 級別一, substr(ename,case when instr(ename,』/』,1,1)>0 then instr(ename,』/』,1,1)+1 else 1 end ,case when instr(ename,』/』,1,2)>0 then instr(ename,』/』,1,2)-1-instr(ename,』/』,1,1) else 10 end) as 級別二,
substr(ename,case when instr(ename,』/』,1,2)>0 then instr(ename,』/』,1,2)+1 else (case when instr(ename,』/』,1,1)>0 then instr(ename,』/』,1,1)+1 else 1 end) end ,case when instr(ename,』/』,1,3)>0 then instr(ename,』/』,1,3)-1-instr(ename,』/』,1,2) else 20 end) as 級別三 ,
substr(ename,case when instr(ename,』/』,1,3)>0 then instr(ename,』/』,1,3)+1 else (case when instr(ename,』/』,1,2)>0 then instr(ename,』/』,1,2)+1 else (case when instr(ename,』/』,1,1)>0 then instr(ename,』/』,1,1)+1 else 1 end) end) end ,case when instr(ename,』/』,1,4)>0 then instr(ename,』/』,1,4)-1-instr(ename,』/』,1,3) else 30 end) as 級別四
from zylemp
1 中國 中國 中國 中國
2 中國 湖北 湖北 湖北
3 中國 湖北 黃岡 黃岡
4 中國 湖北 黃岡 武穴
Oracle 拆分字串
create or replace function splitstr p string in varchar2,p delimiter in varchar2 return str split pipelined as v length number length p string v start...
oracle拆分字串
create or replace type array string is table of varchar2 2000 create or replace function f split string 拆分字串 author zhaohuihua i src in varchar2,待拆分的字...
oracle拆分字串
procedure hand mid sys bpm use role iorgtype in bpm compsite user.orgtype type,idate in date is v orgtype bpm compsite user.orgtype type iorgtype v id...