Population of Oracle DBs from XML?

Forgive me if I haven't fully understood Oracle's new XML parser
for Java, but is it possible to >>directly<< populate an Oracle
database from an XML file or do you have to use the Java parser.
As a developer using Delphi it would be most useful to have a
generic XML to table converter build into Oracle. As far as I
can see the only way at the moment to do this is throgh the Java
VM. Correct me if I'm wrong.
Any comments on this thread would be most appreciated.
Ian Simpson
Appsco Software Ltd.
Aberdeen, Scotland.
null

Thanks a lot for the quick response!
Ian
Oracle XML Team wrote:
: Hi Ian,
: You can do it in a variety of ways. One is to use the XML SQL
: utility which supports insertion of canonical documents into
: tables/views. This calls the parser underneath to parse the
: document and insert it into tables.
: If instead you want to process the XML documents and do
: insertions yourself into different tables/views, then you need
: to use the parser. (there are java,C and C++ versions
: available), parse the document and insert the values. The
parser
: works off on any XML document and gives you an API to process
: the document i.e. walk the document tree, reach a particular
: node etc..
: The other option is the use of IFS to process XML documents
and
: insert them into appropriate tables/views.
: Thx
: Oracle XML team
: Ian Simpson (guest) wrote:
: : Forgive me if I haven't fully understood Oracle's new XML
: parser
: : for Java, but is it possible to >>directly<< populate an
: Oracle
: : database from an XML file or do you have to use the Java
: parser.
: : As a developer using Delphi it would be most useful to have
a
: : generic XML to table converter build into Oracle. As far as
I
: : can see the only way at the moment to do this is throgh the
: Java
: : VM. Correct me if I'm wrong.
: : Any comments on this thread would be most appreciated.
: : Ian Simpson
: : Appsco Software Ltd.
: : Aberdeen, Scotland.
: Oracle Technology Network
: http://technet.oracle.com
null

Similar Messages

  • Insert data into oracle table from XML file

    I need to insert data into oracle table from XML file
    If anybody handled this type of scenario, Please let me know how to insert data into oracle table from XML file
    Thanks in advance

    The XML DB forum provides the best support for XML topics related to Oracle.
    Here's the FAQ on that forum:
    XML DB FAQ
    where there are plenty of examples of shredding XML into Oracle tables and such like. ;)

  • Populating a Crystal Report from XML data

    Hi,
    I want to populate a Crystal Report using a XML data structure. Below I have explained what Iu2019m trying to do in detail,
    u2022 First I will create a Crystal Report using Crystal Report XI R2 designer  by connecting to a Oracle database using a native Oracle connection (not ODBC or JDBC)
    u2022 Then I want to write a Java application using CR XI R2 JRC SDK to open this report
    u2022 Then to run and populate this report using a XML data structure (which I have separately in a disk location. XSD too is available in disk)
    u2022 Then to export this report with data to either PDF or RPT file with saved data in to disk.
    The questions I have are,
    1. Is this possible to do in away?
    2. If so, can you please provide me with a sample code for doing this? I tried some of the other threads in the forum but some had broken links.
    3. Do the xml and the xsd needs to be in a special format?
    4. Is there any other configuration setting I should do?
    Hope you can help me. Thank you in advance.
    Regards,
    Chanaka

    Hi Chinmay,
    Thank you for the prompt answer. I have gone through this before. It explains on how to create a report using a xml database from CR designer. What I want to do is to set the data source programmatically to a xml date source from the code. I didnu2019t find anything like that. Is it the same way as setting the database connection information?
    Also another question I have is how does a report with two tables work? Say I have a master u2013 detail report (order and order lines). The master part is taken from one table (order_tab) and the detail part is taken from another (order_detail_tab). Do I need to have 2 xmls or is one structured xml sufficient? How will the same work if I have the detail section in a sub-report? Will it work with one or do I need to have two?
    Regards,
    Chanaka

  • Insert data into oracle table from XML script not working

    Hi,
    I wrote simple PL/SQL program to extract values from a XML file and disply all the employee names. But the first employee name repeating. Please can you tell me how to fix it.
    set serveroutput on size 2000;
    declare
    indoc VARCHAR2(2000);
    indomdoc dbms_xmldom.domdocument;
    innode dbms_xmldom.domnode;
    myParser dbms_xmlparser.Parser;
    l_nl dbms_xmldom.DOMNodeList;
    lv_value varchar2(30);
    l_n dbms_xmldom.DOMNode;
    begin
    indoc := '<emp> <name> Scott </name>
    <name> Tiger </name>
    </emp>';
    myParser := dbms_xmlparser.newParser;
    dbms_xmlparser.parseBuffer(myParser, indoc);
    indomdoc := dbms_xmlparser.getDocument(myParser);
    innode := dbms_xmldom.makeNode(indomdoc);
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(indomdoc),'/emp/name');
    dbms_output.put_line('Record count '||dbms_xmldom.getLength(l_nl));
    FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
    l_n := dbms_xmldom.item(l_nl, cur_emp);
    lv_value := dbms_xslprocessor.valueOf(l_n,'//name/text()');
    dbms_output.put_line('Emp Name : '||lv_value);
    END LOOP;
    end;
    /

    Based on an earlier example of mine from {message:id=2826611}
    This works in 10.2.x.x for sure. I can't recall (didn't look up) whether in 10.1 it allowed for going straight from a CLOB to a DOMDocument via newDomDocument.
    declare
       indoc    VARCHAR2(2000);
       indomdoc dbms_xmldom.domdocument;
       l_nl     dbms_xmldom.DOMNodeList;
       lv_value VARCHAR2(30);
       l_n      dbms_xmldom.DOMNode;
       l_xmltype   XMLTYPE;
       l_index     PLS_INTEGER;
    begin
       indoc := '<emp> <name> Scott </name>
       <name> Tiger </name>
       </emp>';
       indomdoc := dbms_xmldom.newDomDocument(indoc);
       l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(indomdoc),'/emp/name');
       dbms_output.put_line('Record count '||dbms_xmldom.getLength(l_nl));
       -- Method 1
       FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
          l_n := dbms_xmldom.item(l_nl, cur_emp);
          lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_n));
          dbms_output.put_line('Emp Name : '||lv_value);
       END LOOP;
       dbms_xmldom.freeDocument(indomdoc);
       -- Method 2
       dbms_output.new_line;
       l_xmltype := XMLTYPE(indoc);
       l_index := 1;
       WHILE l_xmltype.Existsnode('/emp/name[' || To_Char(l_index) || ']') > 0
       LOOP
          lv_value := l_xmltype.extract('/emp/name[' || To_Char(l_index) || ']/text()').getStringVal();
          dbms_output.put_line('Emp Name : '||lv_value);
          l_index := l_index + 1;
       END LOOP;
    end;

  • Create ordinary oracle tables from xml

    Hi,
    i have an xml with table names and column names in it, i have to import the ddl's to oracle database.
    please let me know on this

    XMLDB forum Frequently Asked Questions thread: XML DB FAQ

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

  • Data Load from XML file to Oracle Table

    Hi,
    I am trying to load data from XML file to Oracle table using DBMS_XMLStore utility.I have performed the prerequisites like creating the directory from APPS user, grant read/write to directory, placing the data file on folder on apps tier, created a procedure ‘insertXML’ to load the data based on metalink note (Note ID: 396573.1 How to Insert XML by passing a file Instead of using Embedded XML). I am running the procedure thru below anonymous block  to insert the data in the table.
    Anonymous block
    declare
      begin
      insertXML('XMLDIR', 'results.xml', 'employee_results');
      end;
    I am getting below error after running the anonymous block.
    Error :     ORA-22288: file or LOB operation FILEOPEN failed”
    Cause :   The operation attempted on the file or LOB failed.
    Action:   See the next error message in the error stack for more detailed
               information.  Also, verify that the file or LOB exists and that
               the necessary privileges are set for the specified operation. If
               the error still persists, report the error to the DBA.
    I searched this error on metalink and found DOC ID 1556652.1 . I Ran the script provided in the document. PFA the script.
    Also, attaching a document that list down the steps that I have followed.
    Please check and let me know if I am missing something in the process. Please help to get this resolve.
    Regards,
    Sankalp

    Thanks Bashar for your prompt response.
    I ran the insert statement but encountered error,below are the error details. statement.
    Error report -
    SQL Error: ORA-22288: file or LOB operation FILEOPEN failed
    No such file or directory
    ORA-06512: at "SYS.XMLTYPE", line 296
    ORA-06512: at line 1
    22288. 00000 -  "file or LOB operation %s failed\n%s"
    *Cause:    The operation attempted on the file or LOB failed.
    *Action:   See the next error message in the error stack for more detailed
               information.  Also, verify that the file or LOB exists and that
               the necessary privileges are set for the specified operation. If
               the error still persists, report the error to the DBA.
    INSERT statement I ran
    INSERT INTO employee_results (USERNAME,FIRSTNAME,LASTNAME,STATUS)
        SELECT *
        FROM XMLTABLE('/Results/Users/User'
               PASSING XMLTYPE(BFILENAME('XMLDIR', 'results.xml'),
               NLS_CHARSET_ID('CHAR_CS'))
               COLUMNS USERNAME  NUMBER(4)    PATH 'USERNAME',
                       FIRSTNAME  VARCHAR2(10) PATH 'FIRSTNAME',
                       LASTNAME    NUMBER(7,2)  PATH 'LASTNAME',
                       STATUS  VARCHAR2(14) PATH 'STATUS'
    Regards,
    Sankalp

  • How to read the data from XML file and insert into oracle DB

    Hi All,
    I have below require ment.
    I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
    Many Thanks.

    Sounds a lot like this question, only with less details.
    how to read data from XML  variable and insert into table variable
    We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us.  Plenty of examples abound on the forums that cover the topics you seek as well.

  • Porting data from Oracle8i to XML and from XML  to Oracle 10g

    Hai
    I have a client database (using oracle 8i) and a server database (oracle 10g).
    Due to lack of leased line connectivity i want to port these offline data from 8i to 10g
    using a modem(dial up connection).Is there is any way to port data from 8i to XML
    and from XML to 10g.
    thanks in advance
    dejies

    Thanks Nicolas,
    As per documentation, it seems to be difficult for export/import from Oracle8i to 10g. Is that any way to achieve this? I have to append the newly imported data with old or exisiting data into Oracle10g.
    Regards
    Nikhil

  • Populating a SELECT list from an Oracle Table

    Hello,
    I would like to populate a second SELECT list on
    a web page based on the selected value in the first
    SELECT list. I would like to take the value
    that the user selects in the first SELECT list and
    use it in a WHERE clause to bring back distinct
    values to display in the second SELECT list.
    I would like to do this all on a single page. As
    soon as the user selects a value in the first SELECT
    list, then the correct values retrieved from the
    database would appear in the second select list.
    Is this possible? Do you have sample code or ideas??
    I can write JavaScript to get the selected value, but
    I cannot get to Oracle data from the JavaScript environment.
    I can write PL/SQL or Java procedure to access
    Oracle data, but I cannot make the complete connection.
    Help, please.
    thanks
    paul

    Unless you can get every combination back in the first SQL statement, you'd have to do something along the lines of
    - Have the JavaScript submit the page as soon as the first pull-down is selected
    - Have the response be a page identical to the first page, but with the second pull-down populated.
    The other option would be to have a Java applet that can make the second query and return results. Since applets can't connect to the database by default, you'd have to have an app server that would do the actual query.
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com/askDDBC

  • Extract data from XML file to Oracle database

    Dear All
    Please let me know, how to extract data from XML file to Oracle database which includes texts & images.
    Thanking You
    Regards Lakmal Marasinghe

    I would do it from the database, but then again, I am a database / PL/SQL guy.
    IMHO the database will deliver you with more options. I don't know about "speed" between the two.

  • Populating listitem from xml

    I am new to Forms but I am having to learn quickly. I need to populate a listitem from XML.
    The XML already exists (is response from calling REST web service) and is in a variable.
    Is there a simple way of scrolling through this xml file and extracting just the element values e.g. postcode and using these to populate a listitem?
    in .net it is very easy, it seems very hard in Oracle :(
    the xml is
    <?xml version="1.0" encoding="UTF-8"?>
    <al_qb_api_response>
    <addresses>
    <address>
    <id>normal:BOGBBDAzYBwMDAQAAmheiAAAAAAAzNABkAA--</id>
    <type>normal</type>
    <line>34 Collin Avenue, Erith, Kent</line>
    <postcode>DA8 1EE</postcode>
    </address>
    <address>
    <id>normal:COGBBDAzYBwMDAQAAn3ZYAAAAAAAzNABkAA--</id>
    <type>normal</type>
    <line>34 Collin Avenue, Sidcup, Kent</line>
    <postcode>DA15 9DW</postcode>
    </address>
    </addresses>
    </al_qb_api_response>
    thank you.

    in .net it is very easy, it seems very hard in Oracle :(I don't think its so hard in oracle, you simply need some additional steps.
    First, build your code to extract the desired information from the xml-file using Java and the JDeveloper. This should be quite similar to the way you do it in .net . Then, build one method on top of that extraction code which returns a string-array (exactly the values you want to assign to your listitem). Then you can use the forms-java-importer to create a PL/SQL-wrapper around this java-class and simply use the resulting code in PL/SQL in forms.

  • Storing data from XML files in Oracle DB

    Hi!
    I just started to work with XML and need to save data from XML files into Oracle database. I tried to run sample from Oracle web site. The code was following:
    public class xmlwritedb
    public static void main(String args[]) throws SQLException
    String tabName = "EMP"; // Table into which to insert XML data
    String fileName = "emp.xml"; // XML document filename
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Initialize a JDBC connection
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:oci8:scott/tiger@");
    // Insert XML data from file (filename) into
    // database table (tabName)
    OracleXMLSave save = new OracleXMLSave(conn, tabName);
    URL url = save.createURL(fileName);
    int rowCount = save.insertXML(url);
    System.out.println(" successfully inserted "+rowCount+
    " rows into "+ tabName);
    conn.close();
    But it does not work.
    OracleXMLSave object does not see file name.
    Please, help me solve this problem. Also,where is it possible to find any documentation on oracle.xml.* classes API.
    Thank you.
    Maya.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by sudeepk:
    If a java exception is thrown probably during ur install u might have forgotten
    grant javauserpriv to scott;
    grant javasyspriv to scott;
    Thanks
    [email protected]
    <HR></BLOCKQUOTE>
    Thank you!!!

  • Remove XML tags from XML element in Oracle

    Hi,
    I have a requirement where I have to remove all the xml tags from xml element with banks, currently I'm using replace 4 times to replace all different types of xml tags, performance is really bad. is there any better option to remove xml tags from xml data leaving the actual data. please find the example data below.
    select
    TO_CLOB(REPLACE(REPLACE(REPLACE(REPLACE
    ('<Concatcolumn><ConcatGroupID>MyText Data goes here </ConcatGroupID><ConcatGroupID>Data agian</ConcatGroupID></Concatcolumn>','<ConcatGroupID>'),'<Concatcolumn>'),'</ConcatGroupID>',';'),';</Concatcolumn>')) AS Concatcolumn
    from dual
    **************Out put*************
    MyText Data goes here ;Data agian

    One way is to use xquery:
    SQL> with t as
    select xmltype('<Concatcolumn>
                          <ConcatGroupID>MyText Data goes here </ConcatGroupID><ConcatGroupID>Data agian</ConcatGroupID></Concatcolumn>'
       ) xml from dual
    select xmlquery('string-join(//text(), ";")' passing xml returning content).getclobval() xml from t
    XML                                                              
    MyText Data goes here ;Data agian                                
    1 row selected.

  • Populate Oracle DB tables from XML files

    Hi,
    I have to populate tables in a oracle db using XMLs. There'll be one XML file for a single record in the table. Please tell me is there any tool or something to achieve this task or any other approach. I'm using Java+Struts.
    Waiting for a quick reply.
    Amitesh

    Hi,
    This may help you,
    XML Generation Using  DBMS_XMLQuery
    http://sqltech.cl/doc/oracle9i/appdev.901/a89852/d_xmlque.htm
    http://www.oracle-base.com/articles/9i/XMLGeneration9i.php
    http://www.psoug.org/reference/dbms_xmlgen.html
    Regards,
    Rushang

Maybe you are looking for

  • SetRendered(true) not working for an LOV

    Hi, I have a dropdown(soc1) in my page which has three values : A, B and C. Below that drop down are three LOVs (say ilov1, ilov2 and ilov3), which are to be rendered dynamically based on the values selected from the dropdown. i.e. if I select A, the

  • Iam trying to increase the size of the font on my homepage on fox

    My homepage on Firefox is mytelus.com. The print is too small and I want to increase the size of the print. How do I do that? I have been able to increase the size of the print on my homepage on Internet Explorer, but can't seem to find instructions

  • How can I cut and splice audio on the new version of garage band?

       I used to be able to precisely cut and splice audio files on the older versions of garage band. now this whole new version wont let me. the flexwave thing or whatever has taken its place! help please?

  • Connect to SAP with R3 Support stfk.oez file problem~

    Dear Archana, I tried to open R3 support for SAP Verification session. Steps: 1.Service Connector installed and started. 2.SAProuter status shows connected. 3.R3 support is open and shows connected. but there is an question... I set the stfk.oez file

  • What Would Cause This to Happen to the Display?

    My 1 year + old iPhone 5 has recently developed this slight green tint of about 2mm surrounding all four sides of the display. The tint is most obvious when there is a white background, which there are plenty of in iOS 7. The touch screen still works