Oracle: how to add a text node into an existing element

Posted by Alessandro Vernet on Stack Overflow See other posts from Stack Overflow or by Alessandro Vernet
Published on 2009-01-12T23:45:19Z Indexed on 2010/05/07 5:48 UTC
Read the original article Hit count: 247

Filed under:
|
|

In Oracle, you can write:

update t
set xml = updateXML(xml, '/a/b/text()', 'gaga')

This works only if you already have some text in the <b> element. How to update the document and "add some text" in <b> if the document in the database looks like:

<a>
    <b/>
</a>

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about Xml