Xml file to tables

Hello,
I am trying to insert a XML file into the tables. When I read the XSU documentation, I saw a command line utility java OracleXML.
In a book I read, it said before one uses java OracleXML commmand line utility, the XML file has to be converted to another XML file using XSLT for OracleXMLSave to recognize the XML file. This was because OracleXMLSave will know to insert the XML file into the tables only if the XML was generated by OracleXMLquery.
But in the Oracle XML documentation, it didn't explicitly say anything about converting using XSLT to do the loading of the XML file into the tables. But the examples in the site used only the XML file which was generated from the tables to load them into the table again.
Please clarify me on this point.
Thanks a lot for your help.
Rama

Using the Oracle XML DB Webdav are is one method as it acts like a file system, but essentially get's the documents directly into the database so they can be queried through the resouce_view.
Other methods involve reading the file as if it's a CLOB and then using XMLTYPE constructor to change that CLOB to an XMLTYPE which can then be stored as that datatype in the database or processed as you need.
The best place to look is over in the XML DB forum, which has it's own FAQ detailing various best practices for all sort of XML stuff, including reading XML files and shredding them into relational tables etc.
{thread:id=410714}
Edited by: BluShadow on 18-Jan-2012 08:53
corrected link

Similar Messages

  • How can i load Client side XML file to Table

    Hi,
    How can i load the all the XML files (near 10,000 files) available in client machine to the XML table .
    I did try with directrory list in the Webutility demo form, but when the number of file is near to 1,500 its giving error.
    Please suggest the best method to implement my requirements.
    1. XML fies are in a folder in end users machine(Windows OS)
    2. I need to load all the XML files to table (Oracle Database is in Unix)
    I am using forms 10g
    Thanks in advance.
    Rizly

    Hi,
    What is the error you are getting when you reach 1,500 records? Can you post it? You mentioned you are using the webutil to load them. How you are loading? From the client machine you are loading to the database directly? Can you post the code you are using for that?
    -Arun

  • Help needed badly Insert text data from xml files into tables

    Hi all, I have asked to do insertion of text from a xml file into tables upon receiving using pro*c. i've done quite an amount of research on xml parser in c but there wasn't much information for mi to use for implementation...
    Guys don't mind helping me to clarify few doubts of mine...
    1. Where can i get the oracle xml parser libs? Is it included when i installed oracle 8i?
    2. Is there any tutorials or help files for xml parser libs where i can read up?
    I need the xml parser to recognise the tags, followed by recognising the text after the tags.
    eg. xml format
    <studentID> 0012 </studentID>
    <student> john </student>
    <studentID> 0013 </studentID>
    <student> mary </student>
    text willl be inserted into tables like this:
    studentID | student
    0012 | john
    0013 | mary
    by the way i'm using oracle 8i on HP-UX. Thanks in advance.

    I can answer one of of your questions at least
    1. Where can i get the oracle xml parser libs? Is it included when i installed oracle 8i?You need the XML XDK. You can use http://www.oracle.com/technology/tech/xml/xdkhome.html as your starting point. I believe the 9i version works for 8i.
    I have no pro*c experience so I can't offer any other suggestions regarding how to do this in pro*c.

  • Loading data from a XML file to table

    Hi,
    i am using OWB 10g R2.i have to load one XML file to table.
    Can anyone help me in this regard.
    Thanks,
    Priya

    Hi Priya
    There is a post on leveraging XDB with some interesting details;
    http://blogs.oracle.com/warehousebuilder/2007/09/leveraging_xdb.html
    Cheers
    David

  • Create XML file from table data

    Dear All,
    with dataservice 4.0, I want to create an XML file from a table data.
    Table have a single column but more record, for example:
    0001000488;100;EUR;
    0001000489;200;EUR;
    0001000450;300;EUR;
    My desired XML output:
    <Data>
      0001000488;100;GBP;
      0001000489;200;EUR;
      0001000450;300;EUR;
    </Data>
    I try with a sample query but the sistem write only the last record in XML file:
    <Data>
      0001000450;300;EUR;
    </Data>
    Can everyone help me?
    Thank in advance.
    Simone

    Hello
    That is a very simple (also odd) XML document structure, and as such doesn't require use of the XML target.  It can be easily acheived by writing a normal file with a header and footer, which is acheived using a row_generation and a query to generate the hard coded open and close tags.
    Michael

  • Importing content of XML file to table(s)

    I am looking for a way to import updates passed via XML file to a three tables.
    In IBM Domino it was facilitated while using DOMParser class.
    Does JDeveloper have a class or method for updating tables from XML file?

    To import a XML document to a dataabse table:
    1. Add <Oracle10g>/jdbc/lib/ojdbc14.jar, <Oracle10g>/jdbc/lib/servlet.jar, <XDK>/lib/xmlparserv2.jar, <XDK>/lib/xdb.jar and classes12dms.jar to Classpath.
    2. Create a table in Oracle database 10g, which includes columns for each of the element tags in the XML document.
    3. Create a connection with the database.
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@<host>:<port>:<SID>",
    "<user>","<password>");
    4. Create a OracleXMLSave class object.
    OracleXMLSave oracleXMLSave =new OracleXMLSave(conn, "<table>");
    “<table>” is the database table.
    5. Set the tag for the row enclosing element.
    oracleXMLSave.setRowTag("<row-tag>");
    Each <row-tag> tag in the example XML document corresponds to a database column.
    6. Import the XML document to database:
    oracleXMLSave.insertXML(oracleXMLSave.getURL("file://c:/input.xml"));
    7. If the XML document has attributes apply an XSLT to convert the attributes to elements.

  • Moving xml file from table stored as clob to table stored as binary

    We have an xml file we are trying to move from a 10g database to 11gR2. The 11gR2 table is stored as binary, and when we try to insert the row into this table across a dblink from the 10g database the table locks and the system will not complete the transaction. I am wondering if this has something to do with the way the files are stored?

    This would be better in the {forum:id=34} forum. Also include the full version of the 10g DB and the SQL being used and which DB it is running on.

  • Generate XML File from table

    How to generate XML file from a table without using UTL_FILE that too in local machine...

    You downloaded the wrong XML Parser!
    XSQL requires Java Parser. Well, there's a copy included with the XSQL package so you actually don't need to do another download.
    You really don't need XSQL if you just want a XML file from DB, you just needed a XML SQL Utility. Download that and run the samples.

  • Generating XML File with Table data...

    Hi All,
    Bear with me, with my Oracle XML knowledge,,,
    we have Oracle 8i ( Relaease 3) as our database, and managegement want to have XML type of Text file, with respect to data in the Customer Table. Expected XML tags would be the Column Names of the Table.
    Table has three columns,, Name, Address, Telephone.
    So desired XML file looks like below:
    <Name>John Hunter</Name><Address> City Road, London</Address><Telephone>1223223</Telephone>
    If I deceided to do this task using PL/SQL, how could I start it,,,, All comments are welcome, this is the first time that I am going to generate this type of file ,,,

    Hi Chandana,
    You can check out the DBMS_XMLQUERY package for this purpose. It provides XMLType functionality in Oracle 8i. You can access the documentation for the same at:
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_xmlque.htm#ARPLS066
    If you happen to have access to Oracle 9i, then you can use XMLType Views provided with XML DB for your requirement.
    Thanks
    Shefali

  • Load an XML file into table(s)

    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

    for table Country
    create table Country as
    with t as (
        select
        xmltype (
            '<?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>') as xml       
        from dual
    select x.TableLanguage, x.TableCode, x.TableValue
    from t
    ,xmltable('/GraydonBeDialogue/Table[@ClassTable="Country"]/TableEntry'
                       passing t.xml
                       columns TableLanguage varchar2(50) path '/TableEntry/TableLanguage'
                       , TableCode varchar2(50) path '/TableEntry/TableCode'
                       , TableValue varchar2(50) path '/TableEntry/TableValue'                        
                              ) x

  • How to load XML file to table (non-XML) with SQL*Loader -- issue with nulls

    I have been attempting to use SQL*Loader to load an XML file into a "regular" Oracle table. All fields work fine, unless a null is encountered. The way that nulls are represented is shown below:
    <PAYLOAD>
    <FIELD1>ABCDEF</FIELD1>
    <FIELD2/>
    <FIELD3>123456</FIELD3>
    </PAYLOAD>
    In the above example, FIELD2 is a null field and that is the way it is presented. I have searched everywhere and have not found how I could code for this. The issue is that if FIELD2 is present, it is coded like: <FIELD2>SOMEDATA</FIELD2>, but the null is represented as <FIELD2/>. Here is a sample of the control file I am using to attempt the load -- very simplistic, but works fine when fields are present:
    load data
    infile 'testdata.xml' "str '<PAYLOAD>'"
    TRUNCATE
    into table DATA_FROM_XML
    FIELD1 ENCLOSED BY '<FIELD1>' AND '</FIELD1>',
    FIELD2 ENCLOSED BY '<FIELD2>' AND '</FIELD2>',
    FIELD3 ENCLOSED BY '<FIELD3>' AND '</FIELD3>')
    What do I need to do to account for the way that nulls are presented? I have tried everything I could glean from the web and the documentation and nothing has worked. Any help would be really appreciated.

    I hadn't even got that far. can you direct me to where the docs are to import data that is stored within xml but that you don't need any xml functionality, that just happens to be the format the data is stored in? thx

  • Xml file to table script

    Hi all,
    I would be thanks you and greatful if someone can help me to create a table script.
    I have an XML file with PK and FK relationship.
    I also have a DTD file.
    I want to create tables in Oracle Database from XML or DTD file.
    Thanks in Advance
    Saaz

    You might want to take a look at registerSchema (http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xmlsch.htm#sthref9696) with genTables set to TRUE. This would let you use the DTD to create a table structure within Oracle. This may or may not be what you are looking for but you didn't provide many details.
    That's 10.2 documentation so use the edition for your version of Oracle

  • PL/SQL: numeric or value error when extracting xml file from tables.

    create or replace FUNCTION proc_generate_xml_from_tables(p_directory in varchar2,
    p_areaname in varchar2)
    return integer
    AS
    qryCtx DBMS_XMLGEN.ctxHandle;
    result CLOB;
    clob_len number := 0;
    file_ptr utl_file.file_type;
    oTableName restore_metadata.table_name%type;
    o_filename restore_metadata.table_name%type;
    cursor metadata_restore_list(p_area varchar2) is
    select * from restore_metadata
    where instr(area_name,upper(p_Area)) > 0
    order by degree;
    vtabcount number := 0;
    sql_stmt varchar2(300);
    BEGIN
    dbms_lob.createtemporary(result, true,dbms_lob.session);
    oTableName := upper('MAINT_ACTVS');
    vtabcount := 0;
    sql_stmt := 'select count(*) from ' || oTableName;
    execute immediate sql_stmt into vtabcount;
    o_filename := oTableName || '.xml';
    file_ptr := utl_file.fopen(p_directory,o_filename,'W');
    dbms_output.put_line(oTableName);
    qryCtx := dbms_xmlgen.newcontext('select * from ' || oTableName);
    result := dbms_xmlgen.getxml(qryCtx);
    --dbms_output.put_line(result);
    clob_len := dbms_lob.getlength(result);
    dbms_output.put_line('Length of the clob file' || clob_len);
    utl_file.put_line(file_ptr,result);
    utl_file.fclose(file_ptr);
    dbms_xmlgen.closeContext(qryCtx);
    dbms_lob.freetemporary(result);
    return 0;
    EXCEPTION
    when others THEN
    utl_file.fclose(file_ptr);
    dbms_output.put_line('Table Name into Consideration :- ' || oTableName);
    dbms_output.put_line('Oracle Error Number:- ' || sqlcode || ' Ora Message :- ' || sqlerrm);
    return -1;
    END;
    I am getting the following errors..
    SQL> @temp1.sql
    MAINT_ACTVS
    Length of the clob file34245
    Table Name into Consideration :- MAINT_ACTVS
    Oracle Error Number:- -6502 Ora Message :- ORA-06502: PL/SQL: numeric or value error
    What am I doing wrong here?
    DB version is Oracle 10g
    Edited by: userAtoZ on May 6, 2011 2:55 PM

    >
    My problem lies that my xml file is having data more than 32 K.
    When I write it 32K at a time then it work fine.
    >
    Then break it down.
    l_pos number;
    WHILE (l_pos <= clob_len)
      LOOP
        UTL_FILE.PUT_LINE (file_ptr,DBMS_LOB.SUBSTR ( RESULT , 32767,l_pos));
        l_pos := l_pos + 32767;
      END LOOP;
    utl_file.fclose(file_ptr);
     

  • Read xml file to table

    Hi guys
    I m trying to read a very big xml file to a table indicator in a labview
    I had tried both read from xml.vi and read from spreadsheet.
    Either of them gives me a lot of problem.
    Can anyone of u help? I have also browse the example but in vain.
    Can i have an example plss... very simple one...

    Hi sean1985,
    here is an example, how you can create an xml string and read from it. I don´t write the string to a file or read from it, but this should be no problem.
    Hope it helps.
    Mike
    Attachments:
    Unbenannt 7_LV80.vi ‏13 KB

  • Import Large XML File to Table

    I have a large (819MB) XML file I'm trying to import into a table in the format:
    <ROW_SET>
    <ROW>
    <column_name>value</column_name>
    </ROW>
    <ROW>
    <column_name>value</column_name>
    </ROW>
    </ROW_SET>
    I've tried importing it with xmlsequence(...).extract(...) and ran into the number of nodes exceed maximum error.
    I've tried importing it with XMLTable(... passing XMLTYPE(bfilename('DIR_OBJ','large_819mb_file.xml'), nls_charset_id('UTF8'))) and I gave up after it ran for 15+ hours ( COLLECTION ITERATOR PICKLER FETCH issue ).
    I've tried importing it with:
    insCtx := DBMS_XMLStore.newContext('schemaname.tablename');
    DBMS_XMLStore.clearUpdateColumnList(insCtx);
    DBMS_XMLStore.setUpdateColumn(insCtx,'column1name');
    DBMS_XMLStore.setUpdateColumn(insCtx,'columnNname');
    ROWS := DBMS_XMLStore.insertXML(insCtx, XMLTYPE(bfilename('DIR_OBJ','large_819mb_file.xml'), nls_charset_id('UTF8')));
    and ran into ORA-04030: out of process memory when trying to allocate 1032 bytes (qmxlu subheap,qmemNextBuf:alloc).
    All I need to do is read the XML file and move the data into a matching table in a reasonable time. Once I have the data in the database, I no longer need the XML file.
    What would be the best way to import large XML files?
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    "CORE     11.2.0.1.0     Production"
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    This (rough) approach should work for you.
    CREATE TABLE HOLDS_XML
            (xml_col XMLTYPE)
          XMLTYPE xml_col STORE AS SECUREFILE BINARY XML;
    INSERT INTO HOLDS_XML
    VALUES (xmltype(bfilename('DIR_OBJ','large_819mb_file.xml'), nls_charset_id('UTF8')))
    -- Should be using AL32UTF8 for DB character set with XML
    SELECT ...
      FROM HOLD_XML HX
           XMLTable(...
              PASSING HX.xml_col ...)How it differs from your approach.
    By using the HOLDS_XML table with SECUREFILE BINARY XML storage (which became the default in 11.2.0.2) we are providing a place for Oracle to store a parsed version of the XML. This allows the XML to be stored on disk instead of in memory. Oracle can then access the needed pieces of XML from disk by streaming them instead of holding the whole XML in memory and parsing it repeatedly to find the information needed. That is what COLLECTION ITERATOR PICKLER FETCH means. A lot of memory work. You can search on that term to learn more about it if needed.
    The XMTable approach then simply reads this XML from disk and should be able to parse the XML with no issue. You have the option of adding indexes to the XML, but since you are simply reading it all one time and tossing it, there is no advantage to indexes (most likely)

Maybe you are looking for

  • How do I set  my Gmail account to store/ sync 3G's Address and calendar ?

    HELP Well the worst happened... I upgraded my wife's 3G to V2.1 from 2.0.. I conscientiously made sure the iPhone data was backed up before I ran the upgrade ( iTunes 8 told me it was... and I believed it...) and it all went swimmingly.. that is unti

  • Can no longer browse my office Network since Leopard Upgrade

    When i click on the network icon at the office i can no longer browse the network. I am not sure why but there is nothing in that Network icon. Not other computers or anything. Is this a setting that i need to change?

  • Restricted Code For NOKIA 6280 Needed

    What is the reason of buying a phone which should give you problems?Make the above code available for your customers please.Your 12345 is not working at all and the service provider is also asking for the same code

  • Shuffle Won't Shuffle and Only Plays Sometimes

    Help! I received a Shuffle for my birthday last month. I've charged it and loaded it, but it only plays once in a while and won't play at all when on the shuffle model. I've tried updating and upgrading, but it still only works every once in a while!

  • OMBPlus commadn failed to start

    Hi, I have set the OMB path to system variables..when tried to invoke the OMBplus command from cmd prompt i get the error below D:\WebLogic>ombplus "C:\app\mmarri\product\11.2.0\dbhome_1\jdk\jre\bin\java -Xms64M -Xmx768M -XX:MaxPermSize=256M -DORACLE