Updating Resources

You can update XML DB Repository resources using RESOURCE_VIEW. Refer to Table 2-3 in Chapter 2 for the list of XML update functions.

The most commonly used function is the updateXML() function. The following example uses updateXML() to update the XML DB Repository resources (update_xdb_repository.sql):

Listing 3-12 Updating XML DB Repository Using RESOURCE_VIEW

UPDATE RESOURCE_VIEW r

     SET r.res = updateXML(r.res,

               ‘/r:Resource/r:Contents/c:contact/c:first_name/text()’,’John Jr.’,

          ‘xmlns:r=“http://xmlns.oracle.com/xdb/XDBResource.xsd” xmlns:c=“http:// xmlbook.com/sample/contact.xsd”’)

where equals_path(res,‘/public/chp03/event/xmlbook_ann/contacts/john_smith.xml’)=1;

In this process we update ...

Get Oracle Database 11g Building Oracle XML DB Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.