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>
Here is one way to do it:
I don’t find this very elegant, but I am not sure you can do better.