How to Import an XML File within a Batch Job

Previous Next

Suppose an XML file contains row elements with processing instructions, for example:


<Persons>

   <PERSON ID="177" FAMILY_NAME="Haynes" FIRST_NAME="Deborah">

       <Insert/>

   </PERSON>

   <PERSON ID="112" FAMILY_NAME="Smith" FIRST_NAME="John">

       <Update FIRST_NAME="Johnny"/>

   </PERSON>

</Persons>

 

You can process these row elements with their instructions by defining an import task that invokes the internal XML.import method.

To import an XML file within a batch job:

1.Define an IMPORT_XML external set, with File Format: FIXEDVLE, and no Record Separator (empty).
2.Add one element to the IMPORT_XML external set, with Element Name: DOCUMENT, Data Type: CLOB, and no Length (empty).
3.Define an IMPORT_XML import task, with IMPORT_XML as (driving) Import Task Set.
4.Define Import SQL Statement:

INVOKE    XML.IMPORT

WITH

SELECT   DOCUMENT XMLDocument

FROM    IMPORT_XML

 

5.Define an IMPORT_XML job, with one IMPORT_XML import task.

For more information about the internal XML component, please refer to the Definer Help topic: "The XML Import Method".