我想从以下消息中提取特定字符串。(oracle)

时间:2014-02-24 10:30:00

标签: sql oracle

我想从以下消息中提取特定字符串。 我有一条有点像这样的消息

"{1:kkkkkkkkkkkkkkkkkkkkkk}{2:kkkkkkkkkkkkkkkkkkkkkk}{4:
:20:M000000043319452
:25:kkkkkkkkkkkkkkkkkkkkkkUR
:28C:00037/00012
:60M:FGHYYGGGG,52
:61:1402210221CR180,ABCDEFGHIJK//25-15974720-2
BE762/051/DFRR. DFGHYUJI
:86:ADDFCVBG Paid In/AVCDFGHUJKI
kkkkkkkkkk:kkkkkkk GMBH BNK:kkkkkkkkkkkkkkk ACT:ABCDEFGHIJK
INFO:ABCDEFGHIJK CUST111006
:61:1402210221CR588,ABCDEFGHIJK//25-15974757-2
BE762/051/UEB. kkkkkkkkkkkkkk
:86:ADDFCVBG Paid In/XW3000-CT2014-02-21-12.15.45.171881
kkkkkkkkkkk:Mayer ABCDEFGHIJK BNK:RVSADEMX ACT:ABCDEFGHIJK
INFO:GGHJUGG ADDEW 95268AAAAADDDD9646 SSSSS
:61:1402210221DR585854,23NTRFNONREF//25-1SSSSSS768-1
M051/206/FVGBHHHHH.
:86:ADDFCVBG Paid Out Manual
BEN:DD DD DD DD DD
INFO:kkkkkkkkkkkk kkkkkkkkkkkkkkk
:61:1402210221CR285,14NTRFCreditor Payment//25-15975438-2
BE762/051/UEB. BBBBB
:86:BBBBB Paid In/ABCDEFGHIJUKL
kkkkkkkkkkk:Hella KGaA Hueck  BNK:kkkkkkkkkkkkkk ACT:ABCDEFGHIJK
INFO:INV 952687857 05.02.2014
:62F:ABCDEFGHIJK,1
:64:ABCDEFGHIJK,05
:65:ABCDEFGHIJK,1
-}{5:{CHK:kkkkkkkkkkkkkkkk}}"

我想从28c标签中取出00012。我想提取28c标签之后/之前和之前的60M标签之前的任何内容:60M: 请给我任何建议,因为我是oracle的新手。

2 个答案:

答案 0 :(得分:2)

regexp_substr(swift_message, ':28C:.*?/(\S*)', 1, 1, '', 1)

fiddle

答案 1 :(得分:0)

如果您在表格的列中有此按摩内容,那么您可以将其作为

SELECT SUBSTR( SUBSTR( message, INSTR(message,'28C'), INSTR(message,':60M')-INSTR(message,'28C')),INSTR(SUBSTR( message, INSTR(message,'28C'), INSTR(message,':60M')-INSTR(message,'28C')),'/')+1) AS Output_String
FROM table_name

fiddle 其中message是我选择的列名,table_name是表的名称