Following up on Alex's comment, here's an example of merging XML rows (stored as BLOB) in plain Oracle SQL. You haven't given us many details about your table structure and data, so I just made an example table and data. If they're stored as binary XML we'd have to do this a bit differently.
-- simple table, just a row id and a blob, and insert 2 rows
create table xml_test (rnum number, x blob);
insert into xml_test values (1, UTL_RAW.CAST_TO_RAW('<ADC><ABC value="1"></ABC></ADC>'));
insert into xml_test values (2, UTL_RAW.CAST_TO_RAW('<ADC><ABC value="2"></ABC></ADC>'));
-- look at the values we just inserted (using my charset id, 873 - for AL32UTF8)
select rnum, xmltype(x, 873)
from xml_test;
-- merge the rows as described and insert as new row with rnum=3
insert into xml_test (rnum, x)
with cs as -- find your charset ID to decode the blob. 873 for me.
(select NLS_CHARSET_ID(value) as id from nls_database_parameters where parameter='NLS_CHARACTERSET')
SELECT 3 as rn,
XMLQuery('copy $i := $row1 modify
(for $j in $i/ADC
return insert nodes $row2 as last into $j)
return $i'
PASSING xmltype(x1.x, cs.id) as "row1",
XMLQuery('ADC/ABC' passing xmltype(x2.x, cs.id) returning content) as "row2"
RETURNING CONTENT).getBlobVal(cs.id) as x
FROM xml_test x1
JOIN xml_test x2 on x2.rnum = 2 -- row 2
cross join cs
WHERE x1.rnum = 1; -- row 1
-- look at the new row
select xmltype(x, 873)
from xml_test
where rnum = 3;
-- output:
<?xml version="1.0" encoding="UTF-8"?>
<ADC>
<ABC value="1"/>
<ABC value="2"/>
</ADC>