Example: XML export for update

Previous Next

Here is an example of a constraint that calls the XML export method, and updates a database column with the result of the INVOKE statement.

Whenever a person is updated, the fact that this PERSON record is updated is stored in XML format in the XMLupdate column of the PERSON_XML_LOG table.

UPDATE     person_xml_log pxl
SET        pxl.XMLupdate =
     INVOKE     xml.export
     SELECT     'Update' ExecutionType
     ,          *
     ,          OLD(*)
     FROM       person p
     WHERE      p.id = pxl.person_id

After an update of "John Smith" to "Johnny Smith", the XMLupdate column of the PERSON_XML_LOG table contains:

<Persons documentName="Persons">
    <PERSON ID="112" FAMILY_NAME="Smith" FIRST_NAME="John">
        <Update ID="112" FAMILY_NAME="Smith" FIRST_NAME="Johnny"/>



The 'Update' execution type is only useful in constraints in combination with old values.

The execution type is the same for all exported row elements.


See also

Example: Simple XML export

Example: XML export with DTD name and IO formats

Example: XML export in combination with USFile