The db2-xdb:order annotation specifies the insertion order of rows among different tables.
db2-xdb:order belongs to the set of decomposition annotations that can be added to an XML schema document to describe the mappings between elements and attributes of XML documents to DB2® base tables. The decomposition process uses the annotated XML schema to determine how elements and attributes of an XML document should be decomposed into DB2 tables.
Child element of <db2-xdb:rowSetOperationOrder>
<xs:schema>
<xs:annotation>
<xs:appinfo>
<db2-xdb:rowSetOperationOrder>
<db2-xdb:order>
<db2-xdb:rowSet>value</db2-xdb:rowSet>
...
</db2-xdb:order>
</db2-xdb:rowSetOperationOrder>
</xs:appinfo>
</xs:annotation>
…
</xs:schema>
http://www.ibm.com/xmlns/prod/db2/xdb1
Thedb2-xdb:order annotation is used to define the order of insertion of the rows belonging to a given rowSet, relative to the rows belonging to another rowSet. This enables XML data to be inserted into target tables in a way consistent with any referential integrity constraints defined on the tables as part of the relational schema.
All rows of a given rowSet RS1 are inserted before any rows belonging to another rowSet RS2 if RS1 is listed before RS2 within db2-xdb:order. Multiple instances of this element can be specified in order to define multiple insert order hierarchies. For rowSets that do not appear in any element, their rows may be inserted in any order, relative to the rows of any other rowSet.. Also, the content of each <db2-xdb:rowSet> element must be either an explicitly defined rowSet or the name of an existing table for which no explicit rowSet declaration was made.
Multiple rowSet insertion hierarchies can be defined, though a rowSet can appear in only one instance of the <db2-xdb:order> element, and it can appear only once within that element.
For delimited SQL identifiers specified in the children elements, the quotation marks delimiter must be included in the character content and need not be escaped. The ‘&’ and ‘<’ characters used in SQL identifiers, however, must be escaped.
<xs:schema>
<xs:annotation>
<xs:appinfo>
<db2-xdb:rowSetOperationOrder>
<db2-xdb:order>
<db2-xdb:rowSet>CUSTOMER</db2-xdb:rowSet>
<db2-xdb:rowSet>PURCHASE_ORDER</db2-xdb:rowSet>
</db2-xdb:order>
<db2-xdb:order>
<db2-xdb:rowSet>ITEMS_MASTER</db2-xdb:rowSet>
<db2-xdb:rowSet>PO_ITEMS</db2-xdb:rowSet>
</db2-xdb:order>
</db2-xdb:rowSetOperationOrder>
</xs:appinfo>
</xs:annotation>
</xs:schema>
Two disjoint hierarchies for order of insertion
are specified in the above example. The first hierarchy specifies that all
content for the CUSTOMER rowSet or table is inserted prior to any content
collected for PURCHASE_ORDER, and the second hierarchy specifies that all
content for the ITEMS_MASTER rowSet or table will be inserted before any content
is inserted into PO_ITEMS. Note that the order between the two hierarchies
is undefined. For example, any content for the PURCHASE_ORDER rowSet or table
may be inserted before or after any content is inserted into ITEMS_MASTER.