The XML Extender allows you to update untagged data that is stored in XML collection tables. By updating XML collection table values, you are updating the text of an XML element, or the value of an XML attribute. Additionally, updates can delete an instance of data from multiple-occurring elements or attributes.
From an SQL point of view, changing the value of the element or attribute is an update operation, and deleting an instance of an element or attribute is a delete operation. From an XML point of view, as long as the element text or attribute value of the root element_node exists, the XML document still exists and is, therefore, an update operation.
Requirements: To update data in an XML collection, observe the following rules.
In an XML collection, element text and attribute value are all mapped into columns in database tables. Regardless of whether the column data previously exists or is decomposed from incoming XML documents, you replace the data using the normal SQL update technique.
To update an element or attribute value, specify a WHERE clause in the SQL UPDATE statement that contains the join condition that is specified in the DAD file.
For example:
UPDATE SHIP_TAB set MODE = 'BOAT' WHERE MODE='AIR' AND PART_KEY in (SELECT PART_KEY from PART_TAB WHERE ORDER_KEY=68)
The <ShipMode> element value is updated from AIR to BOAT in the SHIP_TAB table, where the key is 68.
To update composed XML documents by eliminating multiple-occurring elements or attributes, delete a row containing the field value that corresponds to the element or attribute value, using the WHERE clause. As long as you do not delete the row that contains the values for the top element_node, deleting element values is considered an update of the XML document.
For example, in the following DELETE statement, you are deleting a <shipment> element by specifying a unique value of one of its subelements.
DELETE from SHIP_TAB WHERE DATE='1999-04-12'
Specifying a DATE value deletes the row that matches this value. The composed document originally contained two <shipment> elements, but now contains one.