Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Load an XML file into table(s)

852132Apr 1 2011 — edited Apr 15 2011
Hi ,

I have to load data from an xml file into an Oracle DB but I never used this king of process before. The purpose is to use as much as possible Oracle standard features ( stored procedures , functions , API's ).
Can someone explain me in simple explanations how to do it ? Thanks in advance for your help.

The XML must not be stored in the database , only the final tables
Values can be inserted , updated , or deleted from the final tables

Here are the versions of the tools I am using :
Oracle RDBMS : 10.2.0.4.0
Oracle Applications : 11.5.10.2
Toad : 9.5.0.31
SQL Plus : 8.0.6.0.0

The header of the xsd :

<?xml version="1.0" encoding="windows-1252" ?>
- <!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by erik de bruyn (Graydon)
-->
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3schools.com" targetNamespace="http://www.w3schools.com" elementFormDefault="qualified">

An extract of the xml :

<?xml version="1.0" encoding="windows-1252" ?>
- <GraydonBeDialogue>
<TransactionCode>RTB</TransactionCode>
- <Table ClassTable="Country">
- <TableEntry>
<TableLanguage>N</TableLanguage>
<TableCode>AD</TableCode>
<TableValue>Andorra</TableValue>
</TableEntry>
- <TableEntry>
<TableLanguage>N</TableLanguage>
<TableCode>AE</TableCode>
<TableValue>Verenigde Arabische Emiraten</TableValue>
</TableEntry>
</Table>
- <Table ClassTable="Summons">
- <TableEntry>
<TableLanguage>N</TableLanguage>
<TableCode>D</TableCode>
<TableValue>De dagvaarding is het gevolg</TableValue>
</TableEntry>
- <TableEntry>
<TableLanguage>N</TableLanguage>
<TableCode>S</TableCode>
<TableValue>Doorgehaald bij de arbeidsrechtbank</TableValue>
</TableEntry>
</Table>
</GraydonBeDialogue>

The result I would have :

Two tables ( Country and Summons ) , each containing 3 columns ( TableLanguage , TableCode , TableValue ) :

Table Country : TableLanguage TableCode TableValue
------------------------------------------------------
N AD Andorra
N AE Verenigde Arabische Emiraten

Table Summons : TableLanguage TableCode TableValue
------------------------------------------------------
N D De dagvaarding is het gevolg
N S Doorgehaald bij de arbeidsrechtbank
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2011
Added on Apr 1 2011
10 comments
18,897 views