Oracle: how to use updateXML to update multiple nodes in a document?
I can write:
update my_table
set xml = updateXML(xml, '/a/b', '1')
where document_id = 123
Now, what if, in the same update request, I also want to set / a / c to 2 (optionally / a / b to 1)? I am tempted to write:
update my_table
set
xml = updateXML(xml, '/a/b', '1'),
xml = updateXML(xml, '/a/c', '2')
where document_id = 123
But it gives me "ORA-00957: duplicate column name". Any suggestion on how to do this?
+1
source to share
2 answers
The documentation indicates that the string and XPath expression can be repeated http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions205.htm#i1134878
try it
update my_table set xml = updateXML (xml, '/ a / b', '1', '/ a / c', '2') where document_id = 123
+3
source to share