Reputation: 1092
I have an XMLTYPE column into a table which contains the value:
<header att1 = '1' att2 = '2' att3 = '3'>
<tag1>val1</tag1>
<tag2>val2</tag2>
<tag3>val3</tag3>
</header>
And I want to extract into an XMLTYPE varaible
<header att1 = '1' att2 = '2' att3 = '3'/>
Can someone help me on this and maybe point me to a XMLQUERY training?
Thanks a lot, Mikcutu.
Upvotes: 1
Views: 128
Reputation: 1092
After I dig into XQuery, I found the answer:
select xmlquery(q'$ for $i in header
return <header att1 = '{$i/@att1}'
att2= '{$i/@att2}'
att3= '{$i/@att3}'/>$'
passing xml_column
returning content)
from table_name
where condition = true;
Upvotes: 0