아래의 데이터를 먼저 참조하십시오. 설명 된대로 처음 두 열에서 HUB_NM, PRODUCT_NM 및 STRIP_NM 열을 계산해야합니다.함께 INSTR 및 SUBSTR 사용
DEAL_ORIGINATION EXCH_SYMBOL HUB_NM PRODUCT_NM STRIP_NM
---------------- ---------------------------------------------- ---------- --------------------- ------------
TT_ICE IPE e-Gas Oil DEC 2010 IPE e-Gas Oil DEC 2010
GLOBEX HO DEC 2010 HO DEC 2010
ICE NG Firm Phys, ID, GDD - Transco-45 - Next Day Gas Transco-45 NG Firm Phys, ID, GDD Next Day Gas
STUSCO_ICE Brent Crude Futures - North Sea - Dec12 Brent Crude Futures DEC12
어떻게 할 수 있습니까? 나는 내가 SUBSTR과 INSTR을 사용해야한다는 것을 알고 있지만 그것을 이해할 수는 없다.
가) EXCH_SYMBOL에서 HUB_NM 열 값을 얻는 방법?
If T.DEAL_ORIGINATION = 'ICE'
then
Find 1st space dash space
Find 2nd space dash space
Display the word in between, no space at the end
elsif T.DEAL_ORIGINATION in ('GLOBEX', 'TT_ICE', 'STUSCO_ICE')
then
null;
end if;
B) EXCH_SYMBOL에서 PRODUCT_NM 열 값을 얻는 방법?
If T.DEAL_ORIGINATION in ('ICE', 'STUSCO_ICE')
then
Display from 1st character to the 1st dash, no space at the end
elsif T.DEAL_ORIGINATION in ('GLOBEX', 'TT_ICE',)
then
Remove -9 caharacters from the end of the word and display the fornt word, no space at the end
end if;
C) EXCH_SYMBOL에서 STRIP_NM 열 값을 얻는 방법?
If T.DEAL_ORIGINATION in ('ICE', 'STUSCO_ICE')
then
Find the 2nd space dash space
Display from then on to the end of the word, no space at the end
elsif T.DEAL_ORIGINATION in ('GLOBEX', 'TT_ICE',)
then
Display the last -8 caharacters from the end of the word, no space at the end
end if;
표 또는 CTE 삽입을위한 샘플 표를 제공 할 수 있습니까? 샘플 데이터에서 머리 또는 꼬리를 만들 수 없습니다. – Harrison
한 번 더 요청하십시오. 의도 한 외출의 A, B, C에 예제를 넣을 수 있습니까? 오라클의 어떤 버전을 사용하고 있습니까? (정규식 응답에 불리한가? REGEXP_SUBSTR & regexp_replace가 사용자가 찾는 대답 일 수 있습니다. – Harrison