Loading XML tables.

Hi,
I have managed to successfully register xml schema and create the xml tables. I now need to load the data into these tables. I am now working on different scenarios of loading the XML data into these tables.
I successfully experimented with the SQL/PLSQL options as well as SQL*Loader. I am reluctant to try the C and JAVA based interfaces because, frankly that is a completely new field for me and will present a huge learning curve that I won’t be able to pull off in short time I need to put this application in production.
My scenario, I have about 250 XML tables which I’m going to populate from XML data files containing thousands of records. I need the lode process to be automatic such that I can do scheduled runs.
The problem I have is SQL*Loader, and I am strictly going by the example given in the Oracle documentation, is that it requires for me to put ‘0’ for every record in the file. Here’s what my sample control file looks like,
LOAD DATA
INFILE *
INTO TABLE "MCF_Custom_Form_Date_Rg" APPEND
xmltype(xmldata)
FIELDS
xmldata LOBFILE (CONSTANT sampleload1.xml) TERMINATED BY '[XML]'
BEGINDATA
0
0
0
This method works if I have finite number of records which I’ll need to count before hand and add a ‘0’ for each record. That’s not an optimal solution because I will not know the number of records before hand. Is there any way of changing this behavior?
I am kind of stumped. What are my other alternatives? I read some where about SAX load utility. Where can I find more documentation about it? Can I run automated loading programs using it?
Any help on this would be greatly appreciated.
Regards,
AVJ.

Anand, you might want to try something using xmldb repository since it allows you to do the FTP operations for the xml files and FTP operations can be scheduled.
First check of your database already accepts FTP operations.
From the command prompt type
FTP
FTP> OPEN <DATABASE SERVER NAME> 2100
Next it asks for a user which you can give database user and password.
Now the lets consider this example schema.
<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0">
     <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
     <xs:complexType name="PurchaseOrderType" xdb:SQLType="XDBPO_TYPE">
          <xs:sequence>
               <xs:element ref="Reference"/>
               <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
               <xs:element name="Reject" type="RejectType" minOccurs="0" xdb:SQLName="REJECTION"/>
               <xs:element ref="Requestor"/>
               <xs:element ref="User"/>
               <xs:element ref="CostCenter"/>
               <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPINGINSTRUCTIONS"/>
               <xs:element ref="SpecialInstructions"/>
               <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
          </xs:sequence>
     </xs:complexType>
     <xs:complexType name="LineItemsType" xdb:SQLType="XDBPO_LINEITEMS_TYPE">
          <xs:sequence>
               <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="XDBPO_LINEITEM_COLLECTION"/>
          </xs:sequence>
     </xs:complexType>
     <xs:complexType name="LineItemType" xdb:SQLType="XDBPO_LINEITEM_TYPE">
          <xs:sequence>
               <xs:element ref="Description"/>
               <xs:element ref="Part"/>
          </xs:sequence>
          <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
     </xs:complexType>
     <xs:element name="Reference" xdb:SQLName="REFERENCE" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="18"/>
                    <xs:maxLength value="30"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="Part" xdb:SQLType="XDBPO_PART_TYPE" xdb:defaultTable="">
          <xs:complexType>
               <xs:attribute name="Id" xdb:SQLName="PARTNO" xdb:SQLType="VARCHAR2">
                    <xs:simpleType>
                         <xs:restriction base="xs:string">
                              <xs:minLength value="12"/>
                              <xs:maxLength value="14"/>
                         </xs:restriction>
                    </xs:simpleType>
               </xs:attribute>
               <xs:attribute name="Quantity" type="money" xdb:SQLName="Quantity" xdb:SQLType="NUMBER"/>
               <xs:attribute name="UnitPrice" type="quantity" xdb:SQLName="UNITPRICE" xdb:SQLType="NUMBER"/>
          </xs:complexType>
     </xs:element>
     <xs:complexType name="ActionsType" xdb:SQLType="XDBPO_ACTIONS_TYPE">
          <xs:sequence>
               <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="XDBPO_ACTION_COLLECTION">
                    <xs:complexType xdb:SQLType="XDBPO_ACTION_TYPE">
                         <xs:sequence>
                              <xs:element ref="User"/>
                              <xs:element ref="Date" minOccurs="0"/>
                         </xs:sequence>
                    </xs:complexType>
               </xs:element>
          </xs:sequence>
     </xs:complexType>
     <xs:complexType name="RejectType" xdb:SQLType="XDBPO_REJECTION_TYPE">
          <xs:all>
               <xs:element ref="User" minOccurs="0"/>
               <xs:element ref="Date" minOccurs="0"/>
               <xs:element ref="Comments" minOccurs="0"/>
          </xs:all>
     </xs:complexType>
     <xs:complexType name="ShippingInstructionsType" xdb:SQLType="XDBPO_SHIPINSTRUCTIONS_TYPE">
          <xs:sequence>
               <xs:element ref="name"/>
               <xs:element ref="address"/>
               <xs:element ref="telephone"/>
          </xs:sequence>
     </xs:complexType>
     <xs:simpleType name="money">
          <xs:restriction base="xs:decimal">
               <xs:fractionDigits value="2"/>
               <xs:totalDigits value="12"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="quantity">
          <xs:restriction base="xs:decimal">
               <xs:fractionDigits value="4"/>
               <xs:totalDigits value="8"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:element name="User" xdb:SQLName="USERID" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="10"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="Requestor" xdb:SQLName="REQUESTOR" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="0"/>
                    <xs:maxLength value="128"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="CostCenter" xdb:SQLName="COSTCENTER" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="4"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="Vendor" xdb:SQLName="VENDOR" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="0"/>
                    <xs:maxLength value="20"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="PONumber" xdb:SQLName="PONUMBER" xdb:SQLType="NUMBER" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:integer"/>
          </xs:simpleType>
     </xs:element>
     <xs:element name="SpecialInstructions" xdb:SQLName="SPECIALINSTRUCTIONS" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="0"/>
                    <xs:maxLength value="2048"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="name" xdb:SQLName="SHIPTONAME" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="20"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="address" xdb:SQLName="ADDRESS" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="256"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="telephone" xdb:SQLName="PHONE" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="24"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="Date" type="xs:date" xdb:SQLName="DATEACTIONED" xdb:SQLType="DATE" xdb:defaultTable=""/>
     <xs:element name="Comments" xdb:SQLName="COMMENTS" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="2048"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="Description" xdb:SQLName="DESCRIPTION" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="256"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
</xs:schema>
Here you can check at the top there is defaultTable="PURCHASEORDER". So after the registration of this schema you will find a table PURCHASEORDER in your database. This table is created only if the GENTABLE parameter value was set to TRUE during schema registration.
Now you can FTP the xml-instance file. Note during the registration of the xml schema, you would have given a URL to identify this schema uniquely in the database.
This URL should be present in the xml-instance file as part of noNamespaceSchemaLocation tag.
Now for FTP operations you need couple of things like a folder path on the reposity. see the documentation on how create the folder on the XMLDB repository.
Now FTP the xml instance file to the folder. Automatically using the value specified in the noNamespaceSchemaLocation tag, Oracle recognizes that this instance file belongs to a particular XML schema which has a defaultTable PURCHASEORDER. It will push this xml file automatically into this table.
you can check that using select count(*) from purchaseorder after the FTP operation.
You can automate this process of FTP operations.
refer documentation XMLDB Developers Guide, it has detail information about repository and how to query your files in the repository.
good luck.

Similar Messages

  • Load XML records in a normal table

    Good afternoon all,
    I have a very simple question:
    I get a XML file and want to store that data in my Oracle database in a normal table.
    I have seen so many answers everywhere, varying from LOBs and using XDB etc.
    What i don't understand is why it is so difficult.
    When i want to load a CSV file in a table I make a very small Control File CTL and from the command prompt / command line I run the SQL Loader.
    Control file:
    load data
    infile 'import.csv'
    into table emp
    fields terminated by "," optionally enclosed by '"'          
    ( empno, empname, sal, deptno )
    command:
    sqlldr user/password@SID control=loader_Control_File.ctl
    Next I connect to the database and run SQL query:
    select * from emp;
    and i see my data as usual, I can make Crystal Reports on it, etc etc
    I really don't understand why this can't be done with an XML file
    Oracle know the fields in the table EMP
    The xml file has around every field the <EMPNO> and </EMPNO>
    Can't be easier than that I would say.
    I can understand Oracle likes some kind of description of the XML table, so reference to a XSD file would be understandable.
    But all examples are describing LOB things (whatever that is)
    Who can help me to get XML data in a normal table?
    Thanks
    Frank

    Hi Frank,
    What i don't understand is why it is so difficult.Why do you think that?
    An SQL*Loader control file might appear very small and simple to you, but you don't actually see what happens inside the loader itself, I guess a lot of complex operations (parsing, datatype mapping, memory allocation etc.).
    XML, contrary to a CSV format, is a structured, well standardized language and could handle far more complex documents than row-organized CSV files.
    I think it naturally requires a few extra work (for a developer) to describe what we want to do out of it.
    However, using an XML schema is not mandatory to load XML data into a relational table.
    It's useful if you're interested in high-performance loading and scalability, as it allows Oracle to fully understand the XML data model it has to deal with, and make the correct mapping with SQL types in the database.
    Furthermore, now with 11g BINARY XMLType, performance has been improved with or without schema.
    Here's a simple example, loading XML file "import.xml" into table MY_EMP.
    Do you find it difficult? ;)
    SQL> create or replace directory test_dir as 'D:\ORACLE\test';
    Directory created
    SQL> create table my_emp as
      2  select empno, ename, sal, deptno
      3  from scott.emp
      4  where 1 = 0
      5  ;
    Table created
    SQL> insert into my_emp (empno, ename, sal, deptno)
      2  select *
      3  from xmltable('/ROWSET/ROW'
      4         passing xmltype(bfilename('TEST_DIR', 'import.xml'), nls_charset_id('CHAR_CS'))
      5         columns empno  number(4)    path 'EMPNO',
      6                 ename  varchar2(10) path 'ENAME',
      7                 sal    number(7,2)  path 'SAL',
      8                 deptno number(2)    path 'DEPTNO'
      9       )
    10  ;
    14 rows inserted
    SQL> select * from my_emp;
    EMPNO ENAME            SAL DEPTNO
    7369 SMITH         800.00     20
    7499 ALLEN        1600.00     30
    7521 WARD         1250.00     30
    7566 JONES        2975.00     20
    7654 MARTIN       1250.00     30
    7698 BLAKE        2850.00     30
    7782 CLARK        2450.00     10
    7788 SCOTT        3000.00     20
    7839 KING         5000.00     10
    7844 TURNER       1500.00     30
    7876 ADAMS        1100.00     20
    7900 JAMES         950.00     30
    7902 FORD         3000.00     20
    7934 MILLER       1300.00     10
    14 rows selected
    import.xml :
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <EMPNO>7369</EMPNO>
      <ENAME>SMITH</ENAME>
      <SAL>800</SAL>
      <DEPTNO>20</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7499</EMPNO>
      <ENAME>ALLEN</ENAME>
      <SAL>1600</SAL>
      <DEPTNO>30</DEPTNO>
    </ROW>
    <!-- more rows here -->
    <ROW>
      <EMPNO>7934</EMPNO>
      <ENAME>MILLER</ENAME>
      <SAL>1300</SAL>
      <DEPTNO>10</DEPTNO>
    </ROW>
    </ROWSET>
    Who can help me to get XML data in a normal table?If you have a specific example, feel free to post it, including the following information :
    - structure of the target table
    - sample XML file
    - database version (select * from v$version)
    Hope that helps.
    Edited by: odie_63 on 9 mars 2011 21:22

  • Loading XML File to Physical table in BW

    Hi,
    I have a requirement to load XML file BW physical table.
    The XML file that I am getting looks pretty complex compared to the XML file I have seen online.
    I need help in transforming the file and Abap code to load the file to physical table
    I have already created the table in SE11.
    XML file
    <?xml version="1.0"?>
    <?mso-application progid="Excel.Sheet"?>
    <Row ss:AutoFitHeight="0" ss:Height="36">
        <Cell ss:StyleID="s62"><Data ss:Type="String">First Name</Data></Cell>
        <Cell ss:StyleID="s62"><Data ss:Type="String">Bank Name -
    add. info</Data></Cell>
       </Row>
       <Row ss:AutoFitHeight="0" ss:Height="22.5" ss:StyleID="s67">
        <Cell><Data ss:Type="String">John Mayor</Data></Cell>
        <Cell><Data ss:Type="String">New: Local bank</Data></Cell
       </Row>
    my requirement is to get this values into physical table i.e
    First name                 bank name
    John Mayor               new: local bank
    thanks
    Edited by: Bhat Vaidya on Apr 14, 2010 11:59 AM
    Edited by: Bhat Vaidya on Apr 14, 2010 12:00 PM
    Edited by: Bhat Vaidya on Apr 14, 2010 12:01 PM
    Edited by: Bhat Vaidya on Apr 14, 2010 12:01 PM

    No longer working on the issue.

  • Loading XML file into DB Table

    Hi
    I m quite new to the loading XML file into database table.
    It will be great if anyone could guide me to through.
    Now,
    i have an XML file which has to be loaded into the DB table.
    what are the steps involved in doing this. How do i go from here ??
    your help is greatly appriciated ???
    Thank you so much!!
    -Shashi

    OK - Although you really should read the XMLDB FAQ on this forum, here is some sample code of ONE of the ways of doing it
    (there are multiple ways - and this is not the most simple one)
    Based on Oracle 11gR1
    -- sqlplus /nolog
    clear screen
    set termout on
    set feed on
    set lines 40
    set long 10000000
    set serveroutput on
    set lines 100
    set echo on
    connect / as sysdba
    col filename for a80
    col xml      for a80
    -- Create schema “OTN”
    drop user OTN cascade;
    purge dba_recyclebin;
    create user OTN identified by OTN;
    grant dba, xdbadmin to OTN;
    EXECUTE dbms_java.grant_permission( 'OTN', 'java.io.FilePermission','G:\OTN\xmlstore','read' );
    prompt pause
    pause
    clear screen
    -- Create directory
    connect OTN/OTN;
    show user
    drop directory OTN_USE_CASE;
    CREATE directory OTN_USE_CASE AS 'G:\OTN\xmlstore';
    SELECT extract((XMLTYPE(bfilename('OTN_USE_CASE','ABANDA-20030407215829881GMT.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from   dual;
    prompt pause
    pause
    clear screen
    -- Directory Listing - Tom Kyte
    create global temporary table DIR_LIST
    ( filename varchar2(255) )
    on commit delete rows
    create or replace
      and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;
    public class DirList
    {public static void getList(String directory)
                       throws SQLException
    {   File path = new File( directory );
        String[] list = path.list();
        String element;
        for(int i = 0; i < list.length; i++)
        {   element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    create or replace procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    prompt pause
    pause
    clear screen
    -- The content of the global temporary table
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list;
    -- "COMMIT" will clear / truncate the global temporary table...
    prompt pause
    pause
    clear screen
    -- Combined: Reading XML content from multiple XML files
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list where filename like '%.xml'
    and rownum <= 10;
    prompt pause
    pause
    clear screen
    select extract((XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from dir_list dl
    where dl.filename like '%.xml' and rownum <= 2;
    prompt pause
    pause
    clear screen
    -- If you can select it you can insert it...
    -- drop table OTN_xml_store purge;
    create table OTN_xml_store of xmltype
    xmltype store as binary xml
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    set time on timing on
    insert into OTN_xml_store
    select XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
    from dir_list dl
    where dl.filename like '%.xml';
    set time off timing off
    commit;
    select count(*) from OTN_xml_store;
    prompt pause
    pause
    clear screen
    -- If you can select it you can create resources and files
    set time on timing on
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select count(*) from dir_list where filename like '%.xml';
    set serveroutput on size 10000
    DECLARE
    XMLdoc XMLType;
    res BOOLEAN;
    v_foldername varchar2(4000) := '/public/OTN/';
    cursor c1
    is
    select dl.filename FNAME
    , XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
    from dir_list dl
    where dl.filename like '%.xml'
    and rownum <= 100;
    BEGIN
    -- Create XDB repository Folder
    if (dbms_xdb.existsResource(v_foldername))
    then
    dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
    end if;
    res:=DBMS_XDB.createFolder(v_foldername);
    -- Create XML files in the XDB Repository
    for r1 in c1
    loop
    if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
    then
    dbms_output.put_line(v_foldername||r1.fname);
    null;
    else
    dbms_output.put_line('Loop Exception :'||sqlerrm);
    end if;
    end loop;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line('Others Exception: '||sqlerrm);
    END;
    set time off timing off
    commit;
    prompt pause
    pause
    clear screen
    -- FTP and HTTP
    clear screen
    prompt
    prompt *** FTP - Demo ***
    prompt
    prompt pause
    pause
    host ftp
    -- open localhost 2100
    -- user OTN OTN
    -- cd public
    -- cd OTN
    -- ls
    -- bye
    clear screen
    prompt
    prompt *** Microsoft Internet Explorer - Demo ***
    prompt
    prompt pause
    pause
    host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OTN:OTN@localhost:8080/public/OTN/
    prompt pause
    pause
    -- Accessing the XDB Repository content via Resource View
    -- Selecting content from a resource via XBDUriType
    clear screen
    prompt set long 300
    set long 300
    prompt Relative Path - (path)
    SELECT path(1) as filename
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 10
    prompt pause
    pause
    clear screen
    prompt Absolute Path - (any_path)
    select xdburitype(any_path).getClob() as xml
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 1;
    prompt pause
    pause
    -- CLEANUP ENVIRONMENT
    clear screen
    prompt
    prompt >>>>> Clean UP !!! <<<<<<
    prompt
    prompt Cleanup environment and drop user...!!!
    prompt
    pause
    clear screen
    conn / as sysdba
    alter session set current_schema=OTN;
    begin
    dbms_xdb.deleteResource('/public/OTN',dbms_xdb.DELETE_RECURSIVE_FORCE);
    commit;
    end;
    alter session set current_schema=sys;
    drop user OTN cascade;
    Based on http://www.liberidu.com/blog/?p=1053

  • Most efficient way to load XML file data into tables

    I have a complex XML file running into MBs. I want to load it's data into 7-8 tables.
    Which way will be better:
    1) Use SQL Loader to actually load directly into the 7-8 tables directly by modifying the control card.
    Is this really possible and feasible? I am not even sure about it
    2) Load data as XML Type in a table and register it. Then extract from there to load into various tables.
    Please help. I have to find the most efficient way of doing it.
    Regards,
    Sudhir

    Yes it is possible to use SQL*Loader to parse and load XML, but that is not what it was designed for and so is not recommended. You also don't need to register a schema, just to load/store/parse XML in the DB either.
    So where does that leave you?
    Some options
    {thread:id=410714} (see page 2)
    {thread:id=1090681}
    {thread:id=1070213}
    Those talk some about storage options and reading in XML from disk and parsing XML. They should also give you options to consider. Without knowing more about your requirements for the effort, it is difficult to give specific advice. Maybe your 7-8 tables don't exist and so using Object Relational Storage for the XML would be the best solution as you can query/update tables that Oracle creates based off the schema associated to the XML. Maybe an External Table definition works better for reading the XML into the system because this process will happen just once. Maybe using WebDAV makes more sense for loading XML to be parsed (I don't have much experience with this, just know it is possible from what I've read on the forums). Also, your version makes a difference as you have different options available depending upon the version of Oracle.
    Hope all that helps as a starter.
    Edited by: A_Non on Jul 8, 2010 4:31 PM
    A great example, see the answers by mdrake in {thread:id=1096784}

  • How to load XML audit trail into an oracle table

    Gents,
    I have a task to load XML sys audit information into a database table.
    Here is a sample audit.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <Audit xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd">
    <Version>11.1</Version>
    <AuditRecord><Audit_Type>8</Audit_Type><EntryId>1</EntryId><Extended_Timestamp>2011-05-04T15:44:08.311370</Extended_Timestamp><DB_User>/</DB_User><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Terminal>pts/11</Terminal><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>CONNECT</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>1</StatementId><EntryId>2</EntryId><Extended_Timestamp>2011-05-04T15:44:12.496857</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>ALTER DATABASE OPEN</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>4</StatementId><EntryId>3</EntryId><Extended_Timestamp>2011-05-04T15:44:32.863959</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>SELECT name, value
    FROM gv$parameter
    WHERE name LIKE '%audit%'</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>5</StatementId><EntryId>4</EntryId><Extended_Timestamp>2011-05-04T15:44:50.448443</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>select count(*) from v$session</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>6</StatementId><EntryId>5</EntryId><Extended_Timestamp>2011-05-04T15:46:37.680404</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>select count(*) from v$session</Sql_Text>
    </AuditRecord>
    </Audit>
    I am using the following code to load it:
    create or replace directory test_dir as '/dbms/oracle/work/sh82993'
    drop table xxrp_acct_header
    create table xxrp_acct_header (
    Audit_Type number,
    Sql_Text varchar2(100)
    DECLARE
    acct_doc xmltype := xmltype( bfilename('TEST_DIR','dbmsdev_ora_720942_1.xml')
    , nls_charset_id('UTF-8') );
    BEGIN
    insert into xxrp_acct_header (Audit_Type, Sql_Text)
    select *
    from xmltable(
    '/Audit/AuditRecord'
    passing acct_doc
    columns Audit_Type path 'Audit_Type'
    , Sql_Text path 'Sql_Text'
    END;
    COMMIT;
    select * from xxrp_acct_header
    However I am having problems with the <Audit .... > tag.
    If a strip the rest following Audit I can get it working but if I leave the part:
    xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd">
    the loading will not work.
    Any ideas?
    All will be appreciated.
    steven

    odie_63 wrote:
    Hi,
    The XML has a default namespace, so you must declare it in XMLTable :
    SELECT *
    FROM XMLTable(
    XMLNamespaces(default 'http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd'),
    '/Audit/AuditRecord'
    passing acct_doc
    columns Audit_Type number        path 'Audit_Type'
    , Sql_Text   varchar2(100) path 'Sql_Text'
    Hi ,
    Can you please tell how can I load the data in the column "Extended_Timestamp" , I defined the column with datatype "TIMESTAMP" in the table but its giving error 'ORA-01830: date format picture ends before converting entire input string" .
    I also tried to add a column with datatype "TIMESTAMP(6) with time Zone" but still giving the same error. What shld be the datatype of the column which will store the corresponding data from extended_timestamp or do I need to format the insert statement , if yes then how ?
    Thanks.

  • Extract Data from XML and Load into table using SQL*Loader

    Hi All,
    We have a XML file (sample.xml) which contains credit card transaction information. We have a standard SQL*Loader control file which loads the data from a flat file and the control file code is written as position based method. Our requirement is to use this control file as per our requirement(i.e) load the data into the table from our XML file), But we need help in converting the XML to a flat file or Extract the data from the XML tags and pass the information to the control file and in turn it loads the table.
    Your suggestion is highly appreciated.
    Thanks in advance

    Hi,
    First of all go to PSA maintanance ( Where you will see PSA records ).
    Goto list---> Save-> File---> Spreadsheet (Choose Radio Button)
    > Give the proper file name where you want to download and then-----> Generate.
    You will get ur PSA data in Excel Format.
    Thanks
    Mayank

  • OWB11gR2 - simple and easy way to load XML formatted data into db tables?

    Hi,
    we're currently trying to load table data stored in XML files into our datawarehouse using OWB 11gR2.
    However, we're finding this is not quite as trivial as loading flat files...
    Most postings on this forum points to the blog-entry title "Leveraging XDB" found here (http://blogs.oracle.com/warehousebuilder/2007/09/leveraging_xdb.html).
    This blog also references the zip-file owb_xml_etl_utils.zip, which seems to have disappeared from it's original location and can now be found on sourceforge.
    Anyway, the solution described is for OWB 10g, and when trying to import experts from the zip-file etc. we end up not being able to run the "Create ETL from XSD" expert, as the 11gR2 client is different from the 10g and does not have the Experts menu et.al.
    Also, this solution was published over 3 years ago, and it seems rather strange that importing XML-formatted data should still be so cumbersome in the newer warehouse builder releases.
    The OWB 11gR2 documentation is very sparse (or rather - quite empty) on how to load XML data, all it has is a few lines on "XML Transformations", giving no clue as to how one goes about loading data.
    Is this really the state of things? Or are we missing some vital information here?
    We'd have thought that with 11g-releases, loading XML-data would be rather simple, quick and painless?
    Is there somewhere besides the blog mentioned above where we can find simple and to the point guidelines for OWB 11gR2 on how to load XML-formatted data into Oracle tables?
    Regards,
    -Haakon-

    Yes it is possible to use SQL*Loader to parse and load XML, but that is not what it was designed for and so is not recommended. You also don't need to register a schema, just to load/store/parse XML in the DB either.
    So where does that leave you?
    Some options
    {thread:id=410714} (see page 2)
    {thread:id=1090681}
    {thread:id=1070213}
    Those talk some about storage options and reading in XML from disk and parsing XML. They should also give you options to consider. Without knowing more about your requirements for the effort, it is difficult to give specific advice. Maybe your 7-8 tables don't exist and so using Object Relational Storage for the XML would be the best solution as you can query/update tables that Oracle creates based off the schema associated to the XML. Maybe an External Table definition works better for reading the XML into the system because this process will happen just once. Maybe using WebDAV makes more sense for loading XML to be parsed (I don't have much experience with this, just know it is possible from what I've read on the forums). Also, your version makes a difference as you have different options available depending upon the version of Oracle.
    Hope all that helps as a starter.
    Edited by: A_Non on Jul 8, 2010 4:31 PM
    A great example, see the answers by mdrake in {thread:id=1096784}

  • Loading XML files into Database table

    Loading XML files into Database table
    Hi I have some XML files say 100 files in a virtual directory created using &quot;Create or replace directory command&quot; and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packages

    Check out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
    Ben

  • Load xml file data in oracle 9i table

    Hi,
    I have oracle 9i R2 (9.2.0.8) and currently i am loading data using sql*loader as i am getting text file. I will be getting file in XML format shortly.
    I would like tp know if there is a sql*loader way to load xml file or another easy method that i can use it?
    If you can provide me very simplest way, i will really appreciate it.
    Thanks,

    Please refer
    http://download-uk.oracle.com/docs/cd/B12037_01/appdev.101/b10790/xdb25loa.htm

  • Problem to load XML SQL Utility into other user

    Hi,
    I need help to load XML Utility into other user than
    "scott"tiger".
    I loaded both xmlparser.jar and oraclexmlsql.jar into
    "scott/tiger", it works and creating functions and testing work
    fine. But when change USER_PASSWORD to another user, it gave me
    some errors like
    creating : org/xml/sax/helpers/AttributeListImpl
    Error while creating class org/xml/sax/helpers/AttributeListImpl
    ORA-29506: invalid query derived from USING clause
    ORA-00942: table or view does not exist
    Error while accessing MD5 table
    ORA-00942: table or view does not exist
    Do I need create any table or view for my another oracle account?
    Or did I missed any thing. From the installation instruction, I
    cano not find any about creating table or view before I load the
    two jar files.
    Thanks
    Yuping
    null

    Hi Yuping,
    Great to hear that! Thx for posting the solution to the
    problem! Let us know if you have any problems with the utility
    or if u need any enhancements!
    Thx
    Murali
    Yuping Zhu (guest) wrote:
    : Hi,Murali,
    : The problem is fixed now. When load xmlparser into the user, it
    : creates two tables automatically, my mistake is I did not grant
    : "create table" privilege to the user. After I granted the
    : privilege to it, it works fine.
    : Thanks!
    : Yuping
    : Murali K (guest) wrote:
    : : Hi,
    : : I will check this out with the Java folks and let u know
    : : Thx
    : : Murali K
    : : Yuping Zhu (guest) wrote:
    : : : Hi, Murali
    : : : I'm using Oracle8i on Solaris 2.6. When I load xmlparser
    : using
    : : : loadjava -resolve -verbose -user $USER_PASSWORD
    xmlparser.jar
    : : : I get error message and I catch part of erros
    : : : PS, I can load it into scott/tiger.
    : : : Thanks!
    : : : Yuping
    : : : loading : org/w3c/dom/html/HTMLLegendElement
    : : : Error while loading org/w3c/dom/html/HTMLLegendElement
    : : : ORA-04068: existing state of packages has been
    discarded
    : : : ORA-04063: package body "IOEXML.LOADLOBS" has errors
    : : : ORA-06508: PL/SQL: could not find program unit being called
    : : : ORA-06512: at line 1
    : : : creating : org/w3c/dom/html/HTMLLegendElement
    : : : Error while creating class
    org/w3c/dom/html/HTMLLegendElement
    : : : ORA-29506: invalid query derived from USING clause
    : : : ORA-00942: table or view does not exist
    : : : Error while accessing MD5 table
    : : : ORA-00942: table or view does not exist
    : : : loading : org/w3c/dom/html/HTMLImageElement
    : : : Error while loading org/w3c/dom/html/HTMLImageElement
    : : : ORA-04068: existing state of packages has been
    discarded
    : : : ORA-04063: package body "IOEXML.LOADLOBS" has errors
    : : : ORA-06508: PL/SQL: could not find program unit being called
    : : : ORA-06512: at line 1
    : : : creating : org/w3c/dom/html/HTMLImageElement
    : : : Error while creating class
    org/w3c/dom/html/HTMLImageElement
    : : : ORA-29506: invalid query derived from USING clause
    : : : ORA-00942: table or view does not exist
    : : : Error while accessing MD5 table
    : : : ORA-00942: table or view does not exist
    : : : loading : oracle/xml/parser/v2/XSLException
    : : : Error while loading oracle/xml/parser/v2/XSLException
    : : : ORA-04068: existing state of packages has been
    discarded
    : : : ORA-04063: package body "IOEXML.LOADLOBS" has errors
    : : : ORA-06508: PL/SQL: could not find program unit being called
    : : : ORA-06512: at line 1
    : : : Murali K (guest) wrote:
    : : : : Hi Yuping,
    : : : : I tried the same on a 8i database and it seems to be
    : : working
    : : : : fine. (loading into two schemas). In fact I just created
    : the
    : : : : other user and it doesnt have any tables or anything in
    it.
    : : : : You do not need to create anything (table/view) extra
    for
    : : : these
    : : : : to work.
    : : : : Which database (Oracle8 or 8i) are u using?
    : : : : Thanks
    : : : : Murali
    : : : : Yuping Zhu (guest) wrote:
    : : : : : Hi,
    : : : : : I need help to load XML Utility into other user than
    : : : : : "scott"tiger".
    : : : : : I loaded both xmlparser.jar and oraclexmlsql.jar into
    : : : : : "scott/tiger", it works and creating functions and
    : testing
    : : : work
    : : : : : fine. But when change USER_PASSWORD to another user,
    it
    : : gave
    : : : me
    : : : : : some errors like
    : : : : : creating : org/xml/sax/helpers/AttributeListImpl
    : : : : : Error while creating class
    : : : : org/xml/sax/helpers/AttributeListImpl
    : : : : : ORA-29506: invalid query derived from USING clause
    : : : : : ORA-00942: table or view does not exist
    : : : : : Error while accessing MD5 table
    : : : : : ORA-00942: table or view does not exist
    : : : : : Do I need create any table or view for my another
    oracle
    : : : : account?
    : : : : : Or did I missed any thing. From the installation
    : : instruction,
    : : : I
    : : : : : cano not find any about creating table or view before
    I
    : : load
    : : : : the
    : : : : : two jar files.
    : : : : : Thanks
    : : : : : Yuping
    null

  • Error while loading xml files using JDBC

    Hi,
    I am trying to load xml files into an xmltype table using JDBC calls and am getting this error for some files
    LPX-00200: could not convert from encoding UTF-8 to UCS2
    The xml files and our database are both UTF-8 encoded. The version of oracle that we have here is 9.2.0.6
    Any suggestions in this matter will be greatly appreciated.
    Thanks,
    Uma

    I also experienced this problem and unfortunately this solution didn't work for me given that the tag you suggested was already on the XML file.

  • Error While Loading XMl Doc into Oracle Database 10g

    Hi all,
    I have a task that , I have to make a utillity by which we can load XML Doc into a Table. While searching on Internet i found following Procedure on ASK Tom
    CREATE OR REPLACE
    procedure insert_xml_emps(
    p_directory in varchar2, p_filename in varchar2, vtableName in varchar2 )
    as
    v_filelocator bfile;
    v_cloblocator clob;
    l_ctx dbms_xmlsave.ctxType;
    l_rows number;
    begin
    dbms_lob.createtemporary(v_cloblocator,true);
    v_filelocator := bfilename(p_directory, p_filename);
    dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
    DBMS_LOB.LOADFROMFILE(v_cloblocator, v_filelocator,
    dbms_lob.getlength(v_filelocator));
    l_ctx := dbms_xmlsave.newContext(vTableName);
    l_rows := dbms_xmlsave.insertxml(l_ctx,v_cloblocator);
    dbms_xmlsave.closeContext(l_ctx);
    dbms_output.put_line(l_rows || ' rows inserted...');
    dbms_lob.close(v_filelocator);
    DBMS_LOB.FREETEMPORARY(v_cloblocator);
    end ;
    when i try to run this procedure
    BEGIN
    insert_xml_emps('XML_LOAD','load.xml','IBSCOLYTD');
    END;
    it gaves me following Error
    ORA-29532: java call terminated by uncaught java exception : Oracle.xml.sql.OracleXMLSQLException:No
    rows to modify-- the row enclosing tag missing. Specify the correct row enclosing tag.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 115
    ORA-06512: at "EXT_TEST.INSERT_XML_EMPS", line 18
    ORA-06512: at line 2
    Can anyone describe me this error
    Thanks.
    Best Regards.

    SQL> /* Creating Your table */
    SQL> CREATE TABLE IBSCOLYTD
      2  (
      3  ACTNOI VARCHAR2 (8),
      4  MEMONOI NUMBER (7,0),
      5  MEMODTEI DATE,
      6  AMOUNTI NUMBER (8,0),
      7  BRCDSI NUMBER (4,0),
      8  TYPEI NUMBER (4,0),
      9  TRANSMONI NUMBER (6,0)
    10  );
    Table created.
    SQL> CREATE OR REPLACE PROCEDURE insert_xml_emps(p_directory in varchar2,
      2                                              p_filename  in varchar2,
      3                                              vtableName  in varchar2) as
      4    v_filelocator    BFILE;
      5    v_cloblocator    CLOB;
      6    l_ctx            DBMS_XMLSTORE.CTXTYPE;
      7    l_rows           NUMBER;
      8    v_amount_to_load NUMBER;
      9    dest_offset      NUMBER := 1;
    10    src_offset       NUMBER := 1;
    11    lang_context     NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
    12    warning          NUMBER;
    13  BEGIN
    14    dbms_lob.createtemporary(v_cloblocator, true);
    15    v_filelocator := bfilename(p_directory, p_filename);
    16    dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
    17    v_amount_to_load := DBMS_LOB.getlength(v_filelocator);
    18    ---  ***This line is changed*** ---
    19    DBMS_LOB.LOADCLOBFROMFILE(v_cloblocator,
    20                              v_filelocator,
    21                              v_amount_to_load,
    22                              dest_offset,
    23                              src_offset,
    24                              0,
    25                              lang_context,
    26                              warning);
    27 
    28    l_ctx := DBMS_XMLSTORE.newContext(vTableName);
    29    DBMS_XMLSTORE.setRowTag(l_ctx, 'ROWSET');
    30    DBMS_XMLSTORE.setRowTag(l_ctx, 'IBSCOLYTD');
    31    -- clear the update settings
    32    DBMS_XMLStore.clearUpdateColumnList(l_ctx);
    33    -- set the columns to be updated as a list of values
    34    DBMS_XMLStore.setUpdateColumn(l_ctx, 'ACTNOI');
    35    DBMS_XMLStore.setUpdateColumn(l_ctx, 'MEMONOI');
    36    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'MEMODTEI');
    37    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'AMOUNTI');
    38    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'BRCDSI');
    39    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TYPEI');
    40    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TRANSMONI');
    41    -- Now insert the doc.
    42    l_rows := DBMS_XMLSTORE.insertxml(l_ctx, v_cloblocator);
    43    DBMS_XMLSTORE.closeContext(l_ctx);
    44    dbms_output.put_line(l_rows || ' rows inserted...');
    45    dbms_lob.close(v_filelocator);
    46    DBMS_LOB.FREETEMPORARY(v_cloblocator);
    47  END;
    48  /
    Procedure created.
    SQL> BEGIN
      2  insert_xml_emps('TEST_DIR','load.xml','IBSCOLYTD');
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM ibscolytd;
    ACTNOI      MEMONOI MEMODTEI     AMOUNTI     BRCDSI      TYPEI  TRANSMONI
    28004125     251942 05-SEP-92        400        513          1          0
    28004125     251943 04-OCT-92        400        513          1          0
    SQL>

  • Error while loading XML files into scott user

    Hi All,
    I'm new to xml files. I need to load xml files into database through OWB.
    I have xml file in my local machine & am trying to load into table PO of Scott. Scott is registered as repository user.
    Followed same steps as specified in userguide.
    But, when executing the procedure ( in two ways one as just table name, and other as user.table name) it is showing the below error:
    Procedure is:(1)--with username.tablename
    begin
    wb_xml_load(
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>&&SAMPLES_DIR.sample1.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target dateFormat="yyyy.MM.dd">scott.PO</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    end;
    ERROR at line 1:
    ORA-20006: Error occurred while truncating target database object SCOTT.PO.
    Base exception: ORA-01031: insufficient privileges
    ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
    ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
    ORA-06512: at "SCOTT.SAMPLE1", line 3
    ORA-06512: at line 1
    Procedure is:(2) with out username
    begin
    wb_xml_load(
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>&&SAMPLES_DIR.sample1.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target dateFormat="yyyy.MM.dd">PO</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    end;
    ERROR at line 1:
    ORA-20006: Error occurred while truncating target database object PO.
    Base exception: ORA-00942: table or view does not exist
    ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
    ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
    ORA-06512: at line 2
    xml file:
    <ROWSET>
    <ROW>
    <ID>100</ID>
    <ORDER_DATE>2000.12.20</ORDER_DATE>
    <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
    <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
    <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
    <SHIPTO_STATE>CA</SHIPTO_STATE>
    <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>     
    </ROWSET>
    Note: Everything works fine if I create PO table in OWBSYS user and execute the procedurein OWBSYS user. OWBSYS.PO table will be loaded.
    What privileges are missing, what shouldI do if I want to execute the procedure from scott user and load the table of scott.
    Thanks in advance for the help.
    Regards,
    Joshna

    Hi Joshna,
    Please follow below steps to load xml file to oracle database.
    1.First connect to owb (Design Center) through your repository owner user (ex : REP_OWNER).
    2. Import WB_XML_LOAD procedure . and exit to repository owner.
    3. connect to owb design center through your repository user (ex : REP_USER)
    Create New mapping and drag one Constant Operator and create one attribute, paste / edit following code
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>E:\SOURCE\emp.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target truncateFirst = "FALSE" dateFormat="yyyy.MM.dd">rep_user.emp</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    4. Drag pre mapping operator and select WB_XML_LOAD procedure
    5. Connect Constant Operator attribute to pre mapping operator.
    6. Drag two dummy tables and connect source to target. (ex : drag t1 (table) tab two times and connect.
    7. Validate and deploy the mapping.
    8. grant necessary grant command to rep_owner user to rep_user user.
    (Note : target truncateFirst = "FALSE" by default truncate the table. So you have to give grant privileges
    To rep_user , select ,insert, delete privileges.
    9. Execute the mapping , and check EMP table. (Note : before loading EMP table delete all records ).
    10 . If you want more description please go through the below link
    http://download.oracle.com/docs/html/A95931_01/apf.htm
    Regards
    Venkat

  • Best method to load XML data into Oracle

    Hi,
    I have to load XML data into Oracle tables. I tried using different options and have run into a dead end in each of those. I do not have knowledge of java and hence have restricted myself to PL/SQL solutions. I tried the following options.
    1. Using DBMS_XMLSave package : Expects the ROWSET and ROW tags. Connot change format of the incoming XML file (Gives error oracle.xml.sql.OracleXMLSQLException: Start of root element expected).
    2. Using the XMLPARSER and XMLDOM PL/SQL APIs : Works fine for small files. Run into memory problems for large files (Gives error java.lang.OutOfMemoryError). Have tried increasing the JAVA_POOL_SIZE but does not work. I am not sure whether I am changing the correct parameter.
    I have read that the SAX API does not hog memory resources since it does not build the entire DOM tree structure. But the problem is that it does not have a PL/SQL implementation.
    Can anyone PLEASE guide me in the right direction, as to the best way to achieve this through PL/SQL ??? I have not designed the tables so am flexible on using purely relational or object-relational design. Although would prefer to keep a purely relational design. (Had tried used object-relational for 1. and purely relational for 2. above)
    The XML files are in the following format, (EXAMINEEs with single DEMOGRAPHIC and multiple TESTs)
    <?xml version="1.0"?>
    <Root_Element>
    <Examinee>
    <MACode>A</MACode>
    <TestingJID>TN</TestingJID>
    <ExamineeID>100001</ExamineeID>
    <CreateDate>20020221</CreateDate>
    <Demographic>
    <InfoDate>20020221</InfoDate>
    <FirstTime>1</FirstTime>
    <LastName>JANE</LastName>
    <FirstName>DOE</FirstName>
    <MiddleInitial>C</MiddleInitial>
    <LithoNumber>73</LithoNumber>
    <StreetAddress>SomeAddress</StreetAddress>
    <City>SomeCity</City>
    <StateCode>TN</StateCode>
    <ZipCode>37000</ZipCode>
    <PassStatus>1</PassStatus>
    </Demographic>
    <Test>
    <TestDate>20020221</TestDate>
    <TestNbr>1</TestNbr>
    <SrlNbr>13773784</SrlNbr>
    </Test>
    <Test>
    <TestDate>20020221</TestDate>
    <TestNbr>2</TestNbr>
    <SrlNbr>13773784</SrlNbr>
    </Test>
    </Examinee>
    </Root_Element>
    Thanks for the help.

    Please refer to the XSU(XML SQL Utility) or TransX Utility(for Multi-language Document) if you want to load data in XML format into database.
    Both of them require special XML formats, please first refer to the following docs:
    http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/xsu/xsu_userguide.html
    http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/transx/readme.html
    You can use XSLT to transform your document to the required format.
    If you document is large, you can use SAX method to insert data into database. But you need to write the code.
    The following sample may be useful:
    http://otn.oracle.com/tech/xml/xdk_sample/xdksample_040602i.html

Maybe you are looking for

  • Open with.....removing apps from list?

    When I right-click and choose 'open with' on a picture for example, I get a huge great list of pre-sets to change the file too. Some of the icons/formats I don't recognise but I think they are a combination of Photoshop, and Flash, Fireworks etc file

  • Final Cut Studio Upgrade?

    Hello! I just recently purchased Final Cut Studio 3 lisence from a local retail store (varimport) and had my 3% discount in price as I'm a student. I'm also very keen to upgrade to the future version of Final Cut Studio and I'd like to know can I upg

  • CFID & CFTOKEN added to URL by CF

    CF automatically appends CFID & CFTOKEN to the URL when using <div <span with id = a variable. They are not appended when a constant is used. I do not want these to be displayed unless I append them myself. Is this a CF bug, or can I change my code s

  • How to refer image shown in one page in another page in same application

    Hi, I am facing some issue in show images on plugin, I uploaded imaged on table, I am able to show those images on region and report. But not able to show the image inside the plugin I am using apex 4.1 and oracle 10 express edition installed I am us

  • Claim Digger Report

    When viewing the report produced by Claim Digger, under the heading bold "General Realtionship Differences" bold, the report shows a Predecessor Activity Name and a Successor Activity Name. Is the report referring to each activity being related to ea