2012-10-30 53 views
0

任何机构可以帮我解决这个问题,我需要使用Oracle 9i,
字符串EXP =“员工数*收费+工作经验”来分割字符串
我的预期输出是在解析“员工编号”“支付”“经验年数”之后。
是否有可能在oracle 9i查询中做,谢谢提前一吨如何在Oracle 9i分割字符串

回答

1

直接的答案是使用SUBSTR和INSTR函数。这里有一个例子:

select substr('Employee * Pay + Years', 1, instr('Employee * Pay + Years', '*') - 2), 
     substr('Employee * Pay + Years', instr('Employee * Pay + Years', '*') + 2, 
        instr('Employee * Pay + Years', '+') - instr('Employee * Pay + Years', '*') - 3), 
     substr('Employee * Pay + Years', instr('Employee * Pay + Years', '+') + 2) 
from dual 

从你那里找你需要的东西。 :)

2
select substr('Employee * Pay + Years of experience',1,instr('Employee * Pay + Years of experience','*')-2),substr('Employee * Pay + Years of experience',instr('Employee * Pay + Years of experience','*')+1,length('Employee * Pay + Years of experience')-instr('Employee * Pay + Years of experience','*')-21),substr('Employee * Pay + Years of experience',instr('Employee * Pay + Years of experience','+')+1) from dual; 
0

选择SUBSTR( '雇员*支付+多年的经验',1,INSTR( '雇员*支付+年以经验的', '*') - 2),SUBSTR(“员工工资* ('Employee * Pay + Years of Experiece','*')+ 2,instr('Employee * Pay + Years of experience','+') - instr('Employee * Pay + Years ('员工*薪酬+经验年数',instr('员工*薪酬+经验年数','+')+ 2);