There are several deprecated Oracle SQL functions for inserting XML nodes into (a copy of) existing XML data.
Each can insert nodes at multiple locations that are referenced by an XPath expression.
That works, but it is less efficient than using one of the other functions, which perform more localized updates.
These functions are covered in detail in the other sections of this appendix.
If you have legacy code that uses these functions, Oracle recommends that you migrate that code to use XQuery Update.
OBJECT_VALUE AS "p"); NAME LINEITEMS ---------------- ---------------------------------------------------------------- Sarah J.
King', '/Purchase Order/Line Items/Line Item/Part[@Id="715515009058"]/@Quantity', 25, '/Purchase Order/Line Items/Line Item[Description/text() = "The Unbearable Lightness Of Being"]', XMLType('')) WHERE XMLExists('$p/Purchase Order[Reference="SBELL-2002100912333601PDT"]' PASSING OBJECT_VALUE AS "p"); SELECT XMLCast(XMLQuery('$p/Purchase Order/Requestor' PASSING po.
The XQuery Update Facility 1.0 Recommendation is supported by Oracle XML DB starting with Oracle Database 12c Release 1 (12.1.0.1).
Prior to this release, to update XML data your queries necessarily used Oracle-specific SQL functions: .
OBJECT_VALUE AS "p"); NAME LINEITEMS ---------------- ------------------------------------------------------------------ Stephen G.
King SELECT XMLCast(XMLQuery('$p/Purchase Order/Requestor' PASSING po. OBJECT_VALUE AS "p" RETURNING CONTENT) AS VARCHAR2(30)) name, XMLQuery('$p/Purchase Order/Line Items' PASSING po.
OBJECT_VALUE AS "p"); PART ---- tables and columns that are stored object-relationally or as binary XML.
For object-relational storage, if particular conditions are met, then the function call can be rewritten to update the object-relational columns directly with the values.
Bell UPDATE purchaseorder SET OBJECT_VALUE = update XML( OBJECT_VALUE, '/Purchase Order/Line Items/Line Item[Part/@Id="715515009058"]/Description', NULL, '/Purchase Order/Line Items/Line Item/Part[@Id="715515009058"]/@Quantity', NULL, '/Purchase Order/Line Items/Line Item[Description/text()= "The Unbearable Lightness Of Being"]', NULL) WHERE XMLExists('$p/Purchase Order[Reference="SBELL-2002100912333601PDT"]' PASSING OBJECT_VALUE AS "p"); SELECT XMLCast(XMLQuery('$p/Purchase Order/Requestor' PASSING po.