views:

183

answers:

2

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>
+1  A: 

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.

Alessandro Vernet
A: 

what is nodes & how to add nodes in Oracle 9i

pankaj