以下のデータを参照してください。最初の2列から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を使うべきだが、私はそれを理解することはできないことを知っている。
A)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に例を入れることができますか?どのOracleのバージョンを使用しているのですか(正規表現の回答に逆らっていますか?REGEXP_SUBSTR&regexp_replaceがあなたの求める答えかもしれません – Harrison