René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
updateXML [Oracle SQL] | ||
updateXML (xml-type, 'xpath-expression, new-value) updateXML (xml-type, 'xpath-expression, new-value, 'namespace') An examplecreate table some_xml of xmltype;
A document is inserted into the xml table. After inserting it, the c-element (containing four) should be updated
to two.
insert into some_xml values(xmltype(' <a> <b x="1">one</b> <c x="2">four</c> <d x="3">three</d> </a>' )); update some_xml set object_value = updateXML(object_value, '/a/*[@x=2]text()', 'two'); select * from some_xml; SYS_NC_ROWINFO$ -------------------------------- <a> <b x="1">one</b> <c x="2">two</c> <d x="3">three</d> </a> |