I have the following SQL:
with q1 ( Tdata,Key) AS (
SELECT (XMLtype(pint.transportdata, nls_charset_id('AL32UTF8')))
, PINT.PAYMENTINTERCHANGEKEY
from bph_owner.paymentinterchange pint
where PINT.TRANSPORTTIME >= to_date('2024-01-11 00:00:00', 'yyyy-mm-dd hh24:mi:Ss')
AND PINT.TRANSPORTTIME < to_date('2024-04-12 00:00:00', 'yyyy-mm-dd hh24:mi:Ss')
AND LENGTH(pint.transportdata)>0
AND PINT.FILEFORMAT like 'pain%'
)
SELECT C1.column_value , q1.Key from q1,
XMLTABLE(
'//*'
PASSING q1.Tdata
) C1
--where regexp_count( C1.column_value,'<') < 2
;
Which works - sample output :
| COLUMN_VALUE |
|---|
<Id xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"><PrvtId><Othr><Id>IE57ZZZ05327119</Id><SchmeNm><Prtry>SEPA</Prtry></SchmeNm>/Othr></PrvtId></Id> |
<PrvtId xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"><Othr><Id>IE57ZZZ05327119</Id><SchmeNm><Prtry>SEPA</Prtry></SchmeNm>/Othr>/PrvtId> |
<Othr xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"><Id>IE57ZZZ05327119</Id><SchmeNm><Prtry>SEPA</Prtry></SchmeNm></Othr> |
<Id xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">IE57ZZZ05327119</Id> |
<SchmeNm xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"><Prtry>SEPA</Prtry></SchmeNm> |
<Prtry xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">SEPA</Prtry> |
But If I try to use the REGEXP_COUNT it gives :
ORA-19011: Character string buffer too small
If I cut the predicate down to a smaller date range I get it to work :
| COLUMN_VALUE |
|---|
<FinInstnId xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"/> |
Any idea how I can get this to work with a larger date range?
CREATE TABLEandINSERTstatements for your sample data to allow us to replicate the problem. (We cannot work out how to get your desired output if we don't know what we are starting with.)