Skip Headers
Oracle® Database SQL Language Reference
11g Release 2 (11.2)

Part Number E10592-04
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

INSERTCHILDXMLAFTER

Syntax

Description of insertchildxmlafter.gif follows
Description of the illustration insertchildxmlafter.gif

Purpose

INSERTXMLCHILDAFTER inserts one or more collection elements as children of target parent elements. The insertion for each target occurs immediately after a specified existing collection element. The existing XML document that is the target of the insertion can be schema-based or non-schema-based.

For more information about this function and its uses, including examples, see Oracle XML DB Developer's Guide.

Examples

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

UPDATE warehouses SET warehouse_spec =
   INSERTCHILDXMLAFTER(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;

WAREHOUSE_NAME                      Owners
----------------------------------- ------------------------------
New Jersey                          <Owner>LesserCo</Owner>
                                    <Owner>GrandCo</Owner>
                                    <Owner>ThirdOwner</Owner>