XXXXXXX, KKKK and prompt the length is not fixed, how to capture? Consult everybody a great god, thank you,
The select error_note from v_table;
XXXXXXXXXXXXXXXX [KKKK_PPPP], "" RspType" XXXXXXXXXXXXXXXX
Small new hand,
thank you?
CodePudding user response:
Baidu regexp_substrCodePudding user response:
You can use the substr functionCodePudding user response:
Regexp_substr on baidu checked, but still won't use, I is how foodCodePudding user response:
KKKK and prompt is separated with _?If it is can use the
Select substr (error_note, INSTR (error_note, '[') + 1, INSTR (error_note,' _ ') - INSTR (error_note, '[') - 1) kk,
Substr (error_note, INSTR (error_note, '_') + 1, INSTR (error_note, '] ') - INSTR (error_note, '_') - 1) pp
The from v_table
CodePudding user response:
ASWITH T(SELECT the 'XXXXXXXXXXXXXXXX [KKKK_PPPP], "" RspType XXXXXXXXXXXXXXXX' S
"The FROM DUAL
UNION ALL
SELECT '[XXX XXXX] XXXXXXXXX [KKKK_PPPP] ", "RspType XXXXXXXXXXXXXXXX' S
"The FROM DUAL
UNION ALL
SELECT 'XXXXXXXXXXXXXXXX [KKKK_PPPP], "asdfasdfa" RspType XXXXXXXXXXXXXXXX' S
"The FROM DUAL)
SELECT the S, S1, REGEXP_SUBSTR (S1, '[^ _] +', 1, 1) K,
REGEXP_SUBSTR (S1, '[^ _] +', 1, 2) P
The FROM (SELECT S REGEXP_REPLACE (S, '. * \ [(\ [^ \ [] +)]. * "RspType". * ', '\') 1 S1
The FROM T)
CodePudding user response: