Anda dapat menggunakan appendChildXML yang disebutkan di atas , seperti di sini:
declare
v_xml xmltype := xmltype('<ord>
<head>
<ord_code>123</ord_code>
<ord_date>01-01-2015</ord_date>
</head>
</ord>');
v_xml2 xmltype:= xmltype('<pos>
<pos_code>456</pos_code>
<pos_desc>description</pos_desc>
</pos>');
v_output xmltype;
begin
select appendChildXML(v_xml, 'ord', v_xml2)
into v_output from dual;
-- output result
dbms_output.put_line( substr( v_output.getclobval(), 1, 1000 ) );
end;
Keluaran:
<ord>
<head>
<ord_code>123</ord_code>
<ord_date>01-01-2015</ord_date>
</head>
<pos>
<pos_code>456</pos_code>
<pos_desc>description</pos_desc>
</pos>
</ord>