Skip Headers
Oracle® Database SQL Language Reference
11g Release 1 (11.1)

Part Number B28286-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

INSERTXMLBEFORE

Syntax

Description of insertxmlbefore.gif follows
Description of the illustration insertxmlbefore.gif

Purpose

INSERTXMLBEFORE inserts a user-supplied value into the target XML before the node indicated by the XPath expression. Compare this function with INSERTCHILDXML.

See Also:

Oracle XML DB Developer's Guide for more information about this function

Examples

The following example is similar to that for INSERTCHILDXML, but it adds a third /Owner node before the /Owner node added in the other example. The output of the query has been formatted for readability.

UPDATE warehouses SET warehouse_spec =
   INSERTXMLBEFORE(warehouse_spec,
   '/Warehouse/Building/Owner[2]',
   XMLType('<Owner>ThirdOwner</Owner>'))
   WHERE warehouse_id = 3;

SELECT warehouse_name, EXTRACT(warehouse_spec, 
   '/Warehouse/Building/Owner') "Owners"
   FROM warehouses
   WHERE warehouse_id = 3;

Name         Owners
------------ --------------------------------------------------------------------
New Jersey <Owner>Grandco</Owner>
           <Owner>ThirdOwner</Owner>
           <Owner>LesserCo</Owner>