I have an XMLType in PL / SQL and I need to rename some of the nodes and some of the values. For instance:
<root> <fields> <a>foo</a> <b>bar</b> </fields> </root>
I want to include in this:
<root> <fields> <a>foo</a> <c>baz</c> </fields> </root>
I know that I can update the value as follows:
SELECT UpdateXML(my_xml, '/root/fields/b/text()', 'baz') INTO my_xml_updated FROM DUAL;
Result:
<root> <fields> <a>foo</a> <b>baz</b> </fields> </root>
But how can I update the name of a node from <b>
to <c>
(without affecting the contents of the node)?
source share