2012-10-30 5 views
0

어떤 몸이이 문제를 해결하기 위해 나를 도울 수있는, 내가 오라클 9i의에게
문자열 특급 = "직원 번호 * 유료 체험 + 년"을 사용하여
은 내 예상을 문자열을 분할해야 출력은 "직원 수" "지불" "경험 년"구문 분석 후입니다.
오라클 9i 쿼리에서 할 수 있습니까? 미리 감사드립니다.오라클 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 

여기서 필요한 것을 얻으십시오. , SUBSTR ('직원 * 급여 - :

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 (2,'* ')'직원 * 지불 경험 + 년 ', 1, INSTR ('* 지불 experiece의 + 년 직원 ') + 임금 + 직장 경험 년 ','* ') + 2, instr ('직원 * 급여 + 경력 년 ','+ ') - instr ('직원 * 급여 + 년 3 년), substr ('직원 * 지불 + 경험 년', instr ('직원 * 지불 + 경험 년', '+') + 2) 듀얼;

관련 문제