1

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>
avernet
  • 30,895
  • 44
  • 126
  • 163

1 Answers1

4

Here is one way to do it:

update t
set xml = updateXML(xml, '/a/b', XMLType('<b>gaga</b>'))

I don't find this very elegant, but I am not sure you can do better.

avernet
  • 30,895
  • 44
  • 126
  • 163