XML data into Oracle Tables. XML file on Application Server.Oracle Apps R12

Hi All,
My Database version : 11.2.0.2.0
I have an XML file which needs to be loaded into the Database Tables. How ever i do not want to use the XMLTYPE as given below
insert into test1 (
SELECT PrcDate, PmtType, PmtStatus, PmtTypeCount, PmtTypeAmt
FROM XMLTABLE(
'/WFPaymentAck/RejectedDom1ACH'
PASSING XMLTYPE( BFILENAME('ECX_UTL_LOG_DIR_OBJ','wf_test_xml.XML'), NLS_CHARSET_ID('UTF8') )
COLUMNS
PrcDate VARCHAR2(2000) PATH '@PrcDate' ,
PmtType VARCHAR2(2000) PATH '@PmtType' ,
PmtStatus VARCHAR2(100) PATH '@PmtStatus' ,
PmtTypeCount VARCHAR2(100) PATH 'PmtTypeCount' ,
PmtTypeAmt VARCHAR2(100) PATH 'PmtTypeAmt'
Because this way the XML file needs to reside on the DB server.
I am looking into other option of loading the XML file into a CLOB column of a table and reading it from that column.
I did a couple of tests and feel that this way also the XML file has to reside on the Database Server itself. I am not sure if this is correct or if there is any problem with our TEST instance.
++Can anyone let me know if i need to have the XML file on the DB server instead of the Application server to load into a CLOB column of table ??++
++Or++
++Is there any other workaround for me to load XML into Oracle Tables, while having the XML file on Application Server.++
Your immediate help is appreciated. I need to get past this ASAP.
Thanks in Advance.
VJ

1) Are you asking me to create a folder on Database directory which points to a folder on the Apps server ?I suggest creating an Oracle directory object (a database object) pointing to a real location (folder) on Application server.
we DONOT want a hand shake between the DB Server and the APPS server.I don't see where the problem is.
I'm not familiar with Apps R12 but there's no doubt the two servers are already communicating, at least App server should be able to access the DB for the whole thing to run.
As I said :
One way or another, the data has to make its way to the database, there's no workaround to that.How do you imagine the data will end up in a database table if it doesn't come to the DB server?
There's no magical method out there, both servers have to communicate at some point.
About client-server approaches (client being here the App server), you can read about accessing the XML DB repository in the XML DB Developer's Guide : http://download.oracle.com/docs/cd/E11882_01/appdev.112/e23094/toc.htm
Other option : SQL*Loader can load a CLOB, or an XMLType column too
Edited by: odie_63 on 19 déc. 2011 20:22

Similar Messages

  • Transfering data from bsis table to file on application server

    Hi Gurus,
    In my program iam selecting data from bsis table and transferring to file on the application server.
    Code:
    Tables: BSIS.
    data: file type rlgrap-filename.
    Select * from BSIS into BSIS.
    Open dataset output in text mode encoding default.
    Transfer bsis to file.
    closesdataset.
    1, Issue when transferring iam getting dump due to type conflict.
    2, Here I cant create a structure like bsis and define type c  
        varialbles as its an upgrade project.
    3, I tried field-symbols using type casting but data in the
        application server is showing junk data with ##### in currncy
        fields.
    4, In earlier program there is no internal table defined for bsis,
        Directly passing to work area and transferring to file on
        application server.
    Please let me know any feasble solution to approach.
    If need i can post the complete code.
    Regards
    Bhaskar

    Hi Robert,
    Here is my code....in ECC. While executing program is going to dump saying character type error.
    tables: bsis.
    data: begin of i_tab occurs 100.
            include structure bsis.
            end of i_tab.
    parameters: outfile(1000) lower case.
    open dataset outfile for output in text mode encoding default
    ignoring conversion errors..
    select * from bsis into table i_tab
    where bukrs = bukrs.
       loop at i_tab.
          transfer i_tab to outfile.
       endloop.
      close dataset.
    Please let me know if any soluton.
    regards
    Bhaskar

  • Loading new xml data into a already xml populated image display

    Hi everybody,
    I have a question about loading new xml data into a already xml populated image gallery.
    So I have my gallery set up so it calls some xml when it first loads. What I would now like to do is load different sets of images via a different xml sheet via the click of a button.
    So for example the loaded gallery already has all thumbs loaded and user can click on them to view the full size image. So next instead of the user having to close this gallery to allow a new gallery to open with a different set of pictures I would just like to have a button. This button will unload the existing thumbs from the gallery and load in new ones from a different xml file.
    If anybody can help me with this it would be great as I am still on a steep learning curve with AS3.
    Here is my AS3
    var xmlPath:String = "pictures.xml";
    var xml:XML;
    var loader = new URLLoader();
    loader.load(new URLRequest(xmlPath));
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    function xmlLoaded(e:Event):void
         if ((e.target as URLLoader) != null )
              xml = new XML(loader.data);
              createMenu();
    var numberOfItems:uint = 0;
    var menuItems:Array = new Array();
    function createMenu():void
              numberOfItems = xml.items.item.length();
         var count:uint = 0;
              for each (var item:XML in xml.items.item)
              var imageLoader=new Loader();
              var menuItem:MenuItem = new MenuItem();
              menuItem.addChild(imageLoader);
              imageLoader.load(new URLRequest(item.url));
              menuItem.linkTo = item.linkTo;
              menuItem.mouseChildren = false;
              menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
              menuItems.push(menuItem);
              addChild(menuItem);
              count++;
    function ***():void
         //menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
         for (var i:uint = 0; i < menuItems.length; i++)
              setChildIndex(menuItems[i], i);

    Thanks so much for the reply Andrei1
    I think maybe my lack of knowledge when it comes to AS3 is not helping me at the moment because I thought I understood the code you supplied but there is something not going quite right.
    So I messed around with the code and added the new_loaded_thumbs_btn to load in the "new_pictures.xml" but I am def doing something wrong.
    import flash.ui.ContextMenuItem;
    var xmlPath:String = "pictures.xml";
    var xml:XML;
    var numberOfItems:uint = 0;
    var menuItems:Array = new Array();
    var loader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    loadXML("pictures.xml");
    new_loaded_thumbs_btn.addEventListener(MouseEvent.CLICK, loadXML);
    function loadXML(path:String):void {
         loader.load(new URLRequest("new_pictures.xml"));
    function loadXML(path:String):void {
         loader.load(new URLRequest(path));
    function xmlLoaded(e:Event):void
         xml = new XML(loader.data);
         createMenu();
    function createMenu():void
         clearMenu();
         numberOfItems = xml.items.item.length();
         var count:uint = 0;
         var imageLoader;
         var menuItem:MenuItem;
         for each (var item:XML in xml.items.item)
              imageLoader = Loader();
              menuItem = new MenuItem();
              menuItem.addChild(imageLoader);
              imageLoader.load(new URLRequest(item.url));
              menuItem.linkTo = item.linkTo;
              menuItem.mouseChildren = false;
              menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
              menuItems.push(menuItem);
              addChild(menuItem);
              count++;
         sortChildren();
    // removes previously placed objects
    function clearMenu():void {
         var menuItem:MenuItem;
         while (menuItems.length > 0) {
              menuItem = menuItems[0];
              removeChildAt(getChildIndex(menuItem));
              menuItem.shift();
    function sortChildren():void
         //menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
         for (var i:uint = 0; i < menuItems.length; i++)
              setChildIndex(menuItems[i], i);
    When the image display 1st loads it displays the new_pictures.xml thumbs which I thought would load through my new button when clicked.
    And there was me thinking I was getting the hang of AS3.
    Could you please point me in the right direction in what I am doing wrong,
    Thanks for your time and effort in advance

  • Open data set for reading excel file on application server in back ground

    open data set for reading excel file on application server in back ground

    hi Vijay,
    I am afraid you won't be able to read from Excel file on Appl. Server.
    ec

  • Loading XML Data into Relational Table

    Hello,
    I receive an XML file generated from another tool (on Windows), I am trying to create a Linux shell script that will gather the needed XML file from my Linux database server, then have Oracle use this file to load the XML data into a relational table. This activity & data will be needed on an ongoing basis.
    I have tried this two ways. First, I loaded the XML document into the database and tried to extract the data directly from the document, but that is not working. Now I want to try to read the data directly from the file on the server via select, however I am not getting any data returned. In the Select statement below, I am simply trying to query the data to see what is returned for my testing.
    Create Table ci_results_table (transactionID Varchar2(100), //transactionID should be PrimaryKey but was getting NULL value errors during insert test, so removed PK
    message Varchar2(200),
    ci Varchar2(50),
    processeddate xmltype,
    status Varchar2(50),
    sourcefile VarChar2(100));
    select x.*
    from XMLTable(
         'TSPLoadResults/Results'
         PASSING xmltype(bfilename('CMDB_DEVADHOCRESULTS_DIR','LoadResults-HP_146.results.xml'), nls_charset_id('AL32UTF8'))
         COLUMNS
           transactionID Varchar2(100) PATH 'TransactionID',
           Result XMLType PATH 'Result',
           Message Varchar2(200) PATH 'Message',
           PrimaryKey Varchar2(50) PATH 'PrimaryKey',
           ProcessedDate date PATH 'ProcessedDate',
           Status Varchar2(50) PATH 'Status',
           SourceFile VarChar2(100) PATH 'SourceFileName'
       ) x
    Eventually I will need to build on this to limit the data returned to those records where SourceFileName is like 'HPDS%' and insert what is returned in to the ci_results_table. Attached is a sample Results XML file I am trying to load, It is named "ResultsTransformedtoUnix" because I used dos2Unix to convert it to Unix which may be right or wrong. (The output file I send out has to be transformed to DOS format before the other application can read it). Original file (before Unix conversion) named in script is also attached.
    Please help. Thank you!

    Hi,
    I see some wrong things in your query.
    1) The obvious one, explaining why you're not getting any data : there's a typo in the XQuery expression, it's "Result" not "Results"
    2) ProcessedDate cannot be extracted as a date (at least not directly) since it actually represents a timestamp, use TIMESTAMP WITH TIME ZONE datatype and cast back to DATE in the SELECT clause
    3) transactionID is an attribute, it must be accessed with '@' (or 'attribute::' axis)
    4) If the file encoding is truly ISO-8859-1 as the prolog suggests, then do not use AL32UTF8 but the corresponding charset name : WE8ISO8859P1
    Here's the working query :
    select x.transactionID
         , x.Message
         , x.Primarykey
         , cast(x.ProcessedDate as date) ProcessDate
         , x.Status
         , x.SourceFile
    from XMLTable(
           '/TSPLoadResults/Result'
           PASSING xmltype(bfilename('XML_DIR','LoadResults-HP_146.results.xml'), nls_charset_id('WE8ISO8859P1'))
           COLUMNS
             transactionID Varchar2(100)            PATH '@transactionID',
             Message       Varchar2(200)            PATH 'Message',
             PrimaryKey    Varchar2(50)             PATH 'PrimaryKey',
             ProcessedDate timestamp with time zone PATH 'ProcessedDate',
             Status        Varchar2(50)             PATH 'Status',
             SourceFile    VarChar2(100)            PATH 'SourceFileName'
         ) x
    Using this query directly over the file will only perform decently (for large files) on 11.2.0.4 and onwards.
    On prior versions, first load the file in a (temporary) XMLType column with Binary XML storage and SELECT from there.
    because I used dos2Unix to convert it to Unix which may be right or wrong.
    This conversion shouldn't be necessary.

  • Xml data into internal table

    Hi Friends,
    See the followong code which converts xml data into itab.
    *& Report  ZTEST_XML1                                                  *
    REPORT  ZTEST_XML1                              .
    *PURPOSE: This program transfers XML data into SAP internal table format
    *The nodes in DOM can be stored as fields in SAP Internal table
    type pool definitions
    TYPE-POOLS: ixml. "iXML Library Types
    type definitions
    TYPES: BEGIN OF t_xml_line, "Structure for holding XML data
    data(256) TYPE x,
    END OF t_xml_line.
    DATA: l_ixml TYPE REF TO if_ixml,
    l_streamfactory TYPE REF TO if_ixml_stream_factory,
    l_parser TYPE REF TO if_ixml_parser,
    l_istream TYPE REF TO if_ixml_istream,
    l_document TYPE REF TO if_ixml_document,
    l_node TYPE REF TO if_ixml_node,
    l_xmldata TYPE string.
    DATA: l_elem TYPE REF TO if_ixml_element,
    l_root_node TYPE REF TO if_ixml_node,
    l_next_node TYPE REF TO if_ixml_node,
    l_name TYPE string,
    l_iterator TYPE REF TO if_ixml_node_iterator.
    DATA: l_xml_table TYPE TABLE OF t_xml_line, " XML Table of the structure
    *t_xml_line
    l_xml_line TYPE t_xml_line, " Record of structure t_xml_line
    l_xml_table_size TYPE i. " XML table size
    DATA: l_filename TYPE string. " String to hold filename
    data: begin of i_final occurs 0,
          pnumber(20),
          pname(50),
          pdes(70),
          end of i_final.
    PARAMETERS: pa_file TYPE char1024 DEFAULT 'C:\product.xml'.
    Validation of XML file: Only DTD included in XML document is supported
    PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
    start of selection
    START-OF-SELECTION.
    Creating the main iXML factory
    l_ixml = cl_ixml=>create( ).
    Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
    PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
    Wrap the table containing the file into a stream.
    l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
    size = l_xml_table_size ).
    Creating a document
    l_document = l_ixml->create_document( ).
    Creating a Parser
    l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
    istream = l_istream
    document = l_document ).
    Validate a document
    IF pa_val = 'X'.
    l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    ENDIF.
    Parse the stream
    IF l_parser->parse( ) <> 0.
    IF l_parser->num_errors( ) <> 0.
    DATA: parseerror TYPE REF TO if_ixml_parse_error,
    str TYPE string,
    i TYPE i,
    count TYPE i,
    index TYPE i.
    count = l_parser->num_errors( ).
    WRITE: count, ' parse errors have occured:'.
    index = 0.
    WHILE index < count.
    parseerror = l_parser->get_error( index = index ).
    i = parseerror->get_line( ).
    WRITE: 'line: ', i.
    i = parseerror->get_column( ).
    WRITE: 'column: ', i.
    str = parseerror->get_reason( ).
    WRITE: str.
    index = index + 1.
    ENDWHILE.
    ENDIF.
    ENDIF.
    Process the document
    IF l_parser->is_dom_generating( ) EQ 'X'.
    PERFORM process_dom USING l_document.
    ENDIF.
    *& Form get_xml_table
    text
    <--P_L_XML_TABLE_SIZE text
    <--P_L_XML_TABLE text
    FORM get_xml_table CHANGING p_l_xml_table_size
    p_l_xml_table.
    Local variable declarations
    DATA: l_len TYPE i,
    l_len2 TYPE i,
    l_tab TYPE tsfixml,
    l_content TYPE string,
    l_str1 TYPE string,
    c_conv TYPE REF TO cl_abap_conv_in_ce,
    l_itab TYPE TABLE OF string.
    l_filename = pa_file.
    Upload file from the client's workstation
    CALL METHOD cl_gui_frontend_services=>gui_upload
    EXPORTING
    filename = l_filename
    filetype = 'BIN'
    IMPORTING
    filelength = l_xml_table_size
    CHANGING
    data_tab = l_xml_table
    EXCEPTIONS
    OTHERS = 19.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Writing the XML document to the screen
    CLEAR l_str1.
    LOOP AT l_xml_table INTO l_xml_line.
    c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement
    = space ).
    c_conv->read( IMPORTING data = l_content len = l_len ).
    CONCATENATE l_str1 l_content INTO l_str1.
    ENDLOOP.
    l_str1 = l_str1+0(l_xml_table_size).
    SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
    WRITE: /.
    WRITE: /' XML File'.
    WRITE: /.
    LOOP AT l_itab INTO l_str1.
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
    l_str1 WITH space.
    WRITE: / l_str1.
    ENDLOOP.
    WRITE: /.
    ENDFORM. " get_xml_table
    *& Form process_dom
    text
    -->P_L_DOCUMENT text
    FORM process_dom USING document TYPE REF TO if_ixml_document.
    DATA: node TYPE REF TO if_ixml_node,
    iterator TYPE REF TO if_ixml_node_iterator,
    nodemap TYPE REF TO if_ixml_named_node_map,
    attr TYPE REF TO if_ixml_node,
    name TYPE string,
    prefix TYPE string,
    value TYPE string,
    indent TYPE i,
    count TYPE i,
    index TYPE i.
    node ?= document.
    CHECK NOT node IS INITIAL.
    ULINE.
    WRITE:/.
    WRITE: /' DOM-TREE'.
    WRITE: /.
    IF node IS INITIAL.
    EXIT.
    ENDIF.
    Create a node iterator
    iterator = node->create_iterator( ).
    Get current node
    node = iterator->get_next( ).
    Loop over all nodes
    WHILE NOT node IS INITIAL.
    indent = node->get_height( ) * 2.
    indent = indent + 20.
    CASE node->get_type( ).
    WHEN if_ixml_node=>co_node_element.
    element node
    name = node->get_name( ).
    nodemap = node->get_attributes( ).
    WRITE: / 'ELEMENT :'.
    WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
    IF NOT nodemap IS INITIAL.
    attributes
    count = nodemap->get_length( ).
    DO count TIMES.
    index = sy-index - 1.
    attr = nodemap->get_item( index ).
    name = attr->get_name( ).
    prefix = attr->get_namespace_prefix( ).
    value = attr->get_value( ).
    WRITE: / 'ATTRIBUTE:'.
    WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
    value COLOR COL_TOTAL INVERSE.
    ENDDO.
    ENDIF.
    WHEN if_ixml_node=>co_node_text OR
    if_ixml_node=>co_node_cdata_section.
    text node
    value = node->get_value( ).
    WRITE: / 'VALUE :'.
    WRITE: AT indent value COLOR COL_GROUP INVERSE.
    ENDCASE.
    Advance to next node
    node = iterator->get_next( ).
    ENDWHILE.
    *delete adjacent duplicates from  i_final.
    *loop at i_final.
    *write:/ i_final-pnumber,i_final-pname,i_final-pdes.
    *endloop.
    *if not i_final[] is initial.
    *modify ztestproduct from table i_final.
    *endif.
    ENDFORM. " process_dom
    in the above code at line no: 268 there is a method:
    value = node->get_value( ).in which actual data from XML file is coming.
    So the varibale "Value" contains the data.
    see line no: 270:
    WRITE: AT indent value COLOR COL_GROUP INVERSE.
    what ever values i am getting here i want to append to a Internal table ...
    Can any body tell me how to do that?
    i am sure of reward points.

    Hai Ravi
    REPORT abc.
    DATA
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
    a(100) TYPE c,
    END OF itab.
    DATA: xml_out TYPE string .
    DATA : BEGIN OF upl OCCURS 0,
    f(255) TYPE c,
    END OF upl.
    DATA: xmlupl TYPE string .
    FIRST PHASE
    FIRST PHASE
    FIRST PHASE
    Fetch Data
    SELECT * FROM t001 INTO TABLE t001.
    XML
    CALL TRANSFORMATION ('ID')
    SOURCE tab = t001[]
    RESULT XML xml_out.
    Convert to TABLE
    CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
    EXPORTING
    i_string = xml_out
    i_tabline_length = 100
    TABLES
    et_table = itab.
    Download
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'BIN'
    filename = 'd:\xx.xml'
    TABLES
    data_tab = itab.
    SECOND PHASE
    SECOND PHASE
    SECOND PHASE
    BREAK-POINT.
    REFRESH t001.
    CLEAR t001.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'D:\XX.XML'
    filetype = 'BIN'
    TABLES
    data_tab = upl.
    LOOP AT upl.
    CONCATENATE xmlupl upl-f INTO xmlupl.
    ENDLOOP.
    XML
    CALL TRANSFORMATION ('ID')
    SOURCE XML xmlupl
    RESULT tab = t001[].
    Regards
    Sreeni

  • INSERTION OF XML DATA INTO THE TABLE USING XMLDOM

    hello,
    i am using XMLDOM to insert the data into the table
    i am using different function of it.
    but i am facing the problem to retrive the the multiple entry.
    like in my example i have two entry of the ' po number '
    & i am using the function
    dbms_xmldom.item(l_nodelist, 0)
    i which i have to pass index no.
    & through this i am getting only single entry according to the index no.
    Example on which i am working is
    declare
    l_xml_data CLOB;
    l_xml_doc dbms_xmldom.domdocument;
    l_nodelist dbms_xmldom.DOMNodeList;
    l_node dbms_xmldom.domnode;
    l_xmltype XMLTYPE;
    l_po_num VARCHAR2(30);
    l_cust_ord VARCHAR2(30);
    l_item_code VARCHAR2(30);
    begin
    l_xml_data := '<?xml version="1.0" encoding="UTF-8"?>
    <!--DOCTYPE MobileInventoryResponse SYSTEM "MobileInventoryResponse.dtd"-->
    <MobileInventoryResponse>
         <message>
              <message-header>
                   <message-id>16244182</message-id>
                   <transaction-name>ship-advice</transaction-name>
                   <partner-name>cbeyond</partner-name>
                   <source-url>http://www.brightpoint.com</source-url>
                   <create-timestamp>20080826150709</create-timestamp>
                   <response-request>1</response-request>
              </message-header>
              <ship-advice>
                   <header>
                        <customer-id>297859</customer-id>
                        <shipment-information>
                             <ship-first-name>RA_13Aug_1</ship-first-name>
                             <ship-last-name>MIND</ship-last-name>
                             <ship-address1>test</ship-address1>
                             <ship-city>test</ship-city>
                             <ship-state>VA</ship-state>
                             <ship-post-code>22102-4931</ship-post-code>
                             <ship-country-code>US</ship-country-code>
    <ship-phone1>0040726335068</ship-phone1>
    <ship-email>[email protected]</ship-email>
    <ship-via>FX01</ship-via>
    <ship-request-date>20080826</ship-request-date>
    <ship-request-warehouse>CBY1</ship-request-warehouse>
    </shipment-information>
    <purchase-order-information>
    <purchase-order-number>380928</purchase-order-number>
    <purchase-order-number>380929</purchase-order-number> ----modi by Ananda Dubey
    <account-description/>
    <purchase-order-amount>0.0</purchase-order-amount>
    <currency-code>USD</currency-code>
    </purchase-order-information>
    <order-header>
    <customer-order-number>0002759</customer-order-number>
    <customer-order-date>20080826</customer-order-date>
    <order-sub-total>19.0</order-sub-total>
    <order-discount>0.0</order-discount>
    <order-tax1>0.0</order-tax1>
    <order-tax2>0.0</order-tax2>
    <order-tax3>0.0</order-tax3>
    <order-shipment-charge>18.0</order-shipment-charge>
    <order-total-net>0.0</order-total-net>
    <order-status>Completed</order-status>
    <order-type/>
    <brightpoint-order-number>35028788</brightpoint-order-number>
    <warehouse-id>CBY1</warehouse-id>
    <ship-date>20080826</ship-date>
    </order-header>
    </header>
    <detail>
    <line-item>
    <line-no>1</line-no>
    <item-code>SKU1</item-code>
    <universal-product-code>0</universal-product-code>
    <ship-quantity>1.0</ship-quantity>
    <unit-of-measure>EA</unit-of-measure>
    <serial-list>
    <serial-numbers>
    <esn>TIMI000013</esn>
    </serial-numbers>
    </serial-list>
    <line-status/>
    <base-price>0.0</base-price>
    <line-discount>0.0</line-discount>
    <line-tax1>0.0</line-tax1>
    <line-tax2>0.0</line-tax2>
    <line-tax3>0.0</line-tax3>
    <bill-of-lading>929406733828</bill-of-lading>
    <scac>FX01</scac>
    </line-item>
    </detail>
    </ship-advice>
    <transactionInfo>
                   <eventID>16244182</eventID>
              </transactionInfo>
         </message>
    </MobileInventoryResponse>';
    l_xml_doc := dbms_xmldom.newDomDocument(l_xml_data);
    -- Method 1 to get data
    l_nodelist := dbms_xmldom.getelementsbytagname(l_xml_doc, 'purchase-order-number');
    l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from list
    l_po_num := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_node));
    dbms_output.put_line(l_po_num);
    l_nodelist := dbms_xslprocessor.selectnodes(dbms_xmldom.makenode(l_xml_doc),
    '/MobileInventoryResponse/message/ship-advice/detail/line-item/item-code');
    l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from list
    l_item_code := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_node));
    dbms_output.put_line(l_item_code);
    l_xmltype := XMLTYPE(l_xml_data);
    l_cust_ord := l_xmltype.extract('/MobileInventoryResponse/message/ship-advice/header/order-header/customer-order-number/text()').getStringVal();
    dbms_output.put_line(l_cust_ord);
    dbms_xmldom.freeDocument(l_xml_doc);
    end;
    /

    In the following code
    l_nodelist := dbms_xmldom.getelementsbytagname(l_xml_doc, 'purchase-order-number');
    l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from listYou need to understand what the second parm on the .item call does. See [dbms_xmldom.item|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xmldom.htm#i1126138]
    The nodelist is a 0 based array of information and you are only requesting to pull the node info in the first array position. So to get the info in the second array position, you need to use ", 1)". You can also use .getLength and a loop to parse through everything in the node list.

  • Inporting XML data into a table

    I have the followiing XML document
    <?xml version="1.0" encoding="utf-8"?>
    <agents count="1382">
    <agent>
    <name>Nancy Palmer</name>
    <email>[email protected]</email>
    <agentid>MLSL:00525350</agentid>
    <officeid>58</officeid>
    <website>http://www.nancypalmer.com</website>
    <photo>https://sites.e-agents.com/Uploads/68/41/6841/Agents/agent_8418_NANCY_PALMER_COLOR_HEAD_SHOT_HIGH_QUALITY_2011.jpg</photo>
    <phone_direct>6504344313</phone_direct>
    <phone_cell>6504920200</phone_cell>
    <mod_time>2012-08-31T05:15:06.933</mod_time>
    </agent>
    <agent>
    <name>Genella Williamson</name>
    <email>[email protected]</email>
    <agentid>MLSL:00755754</agentid>
    <officeid>58</officeid>
    <website>http://www.apr.com/genella</website>
    <photo>https://sites.e-agents.com/Uploads/68/41/6841/Agents/agent_8426_genella.jpg</photo>
    <phone_direct>6504344319</phone_direct>
    <phone_cell>6507870839</phone_cell>
    <mod_time>2010-10-30T15:15:07.603</mod_time>
    </agent>
    <agent>
    <name>Diana Langley</name>
    <email>[email protected]</email>
    <agentid>MLSL:01256202,SFAR:805608</agentid>
    <officeid>50</officeid>
    <website>http://www.apr.com/DLangley</website>
    <photo>https://sites.e-agents.com/Uploads/68/41/6841/Agents/agent_7848_dlangley.jpg</photo>
    <phone_direct/>
    <phone_cell/>
    <mod_time>2011-06-06T05:15:06.587</mod_time>
    </agent>
    </agents>
    I want to load it to the following table
    SQL> desc apr_agent
    Name Null? Type
    NAME VARCHAR2(100)
    EMAIL VARCHAR2(100)
    OFFICEID VARCHAR2(50)
    WEBSITE VARCHAR2(1000)
    PHOTO VARCHAR2(1000)
    PHONE_DIRECT VARCHAR2(100)
    PHONE_CELL VARCHAR2(100)
    MOD_DATE VARCHAR2(100)
    SQL>
    So I created a directory
    create or replace directory APR_STG as '/opt/smarteragent/procdata/APR';
    and I created the following insert statement
    INSERT INTO apr_agent
    (NAME, email, officeid, website, photo, phone_direct, phone_cell, mod_date)
    WITH T AS (SELECT XMLTYPE(BFILENAME('APR_STG','agents.xml'), NLS_CHARSET_ID('AL32UTF8')) xmlcol FROM dual)
    SELECT EXTRACTVALUE(VALUE(x),'/ROW/name') NAME,
    EXTRACTVALUE(VALUE(x),'/ROW/email') email,
    EXTRACTVALUE(VALUE(x),'ROW/officeid') officeid,
    EXTRACTVALUE(VALUE(x),'ROW/website') website,
    EXTRACTVALUE(VALUE(x),'ROW/photo') photo,
    EXTRACTVALUE(VALUE(x),'ROW/phone_direct') phone_direct,
    EXTRACTVALUE(VALUE(x),'ROW/phone_cell') phone_cell,
    EXTRACTVALUE(VALUE(x),'ROW/mod_time') mod_date
    FROM T,TABLE(XMLSEQUENCE(EXTRACT(T.xmlcol,'/ROWSET/ROW'))) x;
    I am currently getting now rows inserted. Not sure why?
    Any help would be greatly appreciated.

    Well, if you were to run the SELECT statement alone (from WITH on down), you would see that it is returning 0 rows. After some head-scratching and searching you would come to realize it is because your XPaths are not finding any data in the XML. In your XPaths, you are looking for a root node of ROWSET with a child of ROW. In the XML, the root node is agents and the child is agent. Assuming you are on 10.2 or later, your SELECT statement itself could be written as
    SELECT NAME, email,
           officeid, website,
           photo, phone_direct,
           phone_cell, mod_date
      FROM XMLTable('/agents/agent'
                    PASSING XMLType(BFILENAME('APR_STG','agents.xml'), NLS_CHARSET_ID('AL32UTF8'))
                    COLUMNS
                    NAME         VARCHAR2(100) PATH 'name',
                    email        VARCHAR2(100) PATH 'email',
                    officeid     VARCHAR2(50) PATH 'officeid',
                    website      VARCHAR2(1000) PATH 'website',
                    photo        VARCHAR2(1000) PATH 'photo',
                    phone_direct VARCHAR2(100) PATH 'phone_direct',
                    phone_cell   VARCHAR2(100) PATH 'phone_cell',
                    mod_date     VARCHAR2(100) PATH 'mod_time');and then you could just append that to your INSERT so you have something like
    INSERT INTO apr_agent
    (NAME, email, officeid, website, photo, phone_direct, phone_cell, mod_date)
    SELECT NAME, email,....If the count of 1382 is to be believed, then you may start wondering why your INSERT is taking so long to process. Performance will depend upon many factors.
    If you are on 11g (any of them), then you have an option to improve performance over 10.2 and earlier versions. You simply create a table, it could even be a Global Temporary Table that looks something like
    create table TEMP_XML (XML_DATA xmltype)
    xmltype column XML_DATA store as securefile binary xml;(if on 11.2.0.2 or later, you only need)
    create table TEMP_XML (XML_DATA xmltype);Then you insert the XML data into it via
    INSERT INTO TEMP_XML VALUES XMLType(BFILENAME('APR_STG','agents.xml'), NLS_CHARSET_ID('AL32UTF8')));and change the above SELECT statement to read from that table instead, such as
    SELECT NAME, email,
           officeid, website,
           photo, phone_direct,
           phone_cell, mod_date
      FROM TEMP_XML tx
           XMLTable('/agents/agent'
                    PASSING tx.xml_data
    ...And then you'll be done with that task.
    Note: Only the first SQL statement was verified, the rest should be valid but have not been executed/verified.

  • Getting the Datatype error data into a table or file

    Hi experts,
    I have a scenario where I need to capture the datatype mismatch records between source & target or the data length error records into a table or file.
    For example.
    1. I have source table column of datatype varchar which is mapped to a target table column of datatype Integer.
    2. I have source table column of datatype varchar2(2000) is mapped to a target table column of datatype varchar2(200).
    I know that while interface execution, if any of the above scenario comes an error occurs respectively and execution stops.
    My question is whether is there anyway to capture those types of records and insert into a table or file. If yes kindly suggest me how to do it.
    Thanks in advance

    Hi Siva,
    Use SqlUnload tool to capture error out records in excel file.
    Hope this will helps you
    Thanks,
    Phani

  • How to load xml data into a table

    Hi,
    i am a newbie. I want to insert the data of xml file into a table. I am doing this using XSU api for java.
    I am using oracle 9i and jdk 1.7.
    I am using OracleXmlSave class.
    but i am getting following error.
    java.lang.NoClassDefFoundError: oracle/jdbc2/Clob
    Please help in this regard. this is my first thread.
    thanks.
    Edited by: 979682 on Jan 3, 2013 3:39 AM

    Hi,
    You can insert XML data from XML file to Oracle database by this script :
    Hi,
    For reading and inserting the data from XML file to Oracle Database :
    1. CREATE A BLANK TABLE with same structure as XML file :
    select * from xml_test
    2. SELECT QUERY DIRECTLY ON XML FILE :
    SELECT XMLTYPE(bfilename('TEST_DIR', 'data_file.xml'), nls_charset_id('UTF8')) xml_data FROM dual
    3. CREATE ORACLE DIRECTORY AND PLACE XML FILE IN THIS DIRECTORY LOCATION:
    --CREATE DIRECTORY TEST_DIR as '/oracle/test';
    --grant all on directory TEST_DIR to public;
    4. INSERT THE XML DATA IN ORACLE TABLE:
    INSERT INTO xml_test(column1,coumn2)
    WITH t AS (SELECT XMLTYPE(bfilename('TEST_DIR', 'attachment.xml'), nls_charset_id('UTF8')) xml_col FROM dual)
    SELECT
    extractValue(value(x),'/ROW/COLUMN1') column1
    ,extractValue(value(x),'ROW/COLUMN2') column2
    FROM t,TABLE(XMLSequence(extract(t.xml_col,'/ROWSET/ROW'))) x;
    I have assumed a table with 2 columns.
    Regards,
    Rohit Chaudhari
    [email protected]

  • Load XML Data into relational Table

    Hi All,
    I have a requirement to load data in an XML file into columns in an oracle table. This has to be done on the command line from a unix box which connects to a remote oracle DB.
    Can some one give me a step by step procedure to do this (preferably using sqlloader) or point me in the right direction.
    thank you

    Hi,
    Read "Oracle XML DB Developer's guide", Chapters 2,3,4,5.
    That will give you very good idea.
    The reason, I am suggesting reading is, there is not "one" way to do it. There can be many good ways, depending on the size, complexity of the XML and also your intended use of that XML data.
    Regards

  • Loading xml data into eexternal table

    emp.xml is xml file namewhich is saved in C:\Documents and Settings\james\Desktop\emp.xml
    xml file
    <EMPLOYEES>
    <EMP>
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    <HIREDATE>17-DEC-80</HIREDATE>
    <SAL>800</SAL>
    </EMP>
    <EMP>
    <EMPNO>7499</EMPNO>
    <ENAME>ALLEN</ENAME>
    <JOB>SALESMAN</JOB>
    <HIREDATE>20-FEB-81</HIREDATE>
    <SAL>1600</SAL>
    <COMM>300</COMM>
    </EMP>
    </EMPLOYEES>
    CREATE DIRECTORY my_xml_dir AS 'C:\Documents and Settings\james\Desktop\emp.xml'
    CREATE TABLE my_xml_et ( EMPNO NUMBER, EMPNAME VARCHAR2(10), JOB VARCHAR2(10), HIREDATE DATE, SAL NUMBER )
    using external tables how this xml data is loaded into my_xml_et

    I think you mean you are trying to load an XML from/using an external table.
    However, external tables are typically best suited to flat file structures rather than XML nested structures.
    What you require is one of the many techniques for shredding an XML document into oracle table structures.
    More information on these techniques can be found in the XML DB forum, with plenty of useful links in the FAQ for that forum...
    XML DB FAQ

  • Load XML data into MySQL table

    I have numerous XML files, one for each record, with a structure like this (only a small part actually, each file is around 170 KB):
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <speccydata version="1.20.446" formatversion="2.0" languageID="0" time="20130323T222711" localtime="20130323T232711+0100">
        <mainsection title="Summary">
            <section title="Operating System" id="1">
                <entry value="Microsoft Windows 8 Enterprise 64-bit" />
            </section>
            <section title="CPU" id="2">
                <entry title="Intel Core i7 3930K @ 3.20GHz" value="32 °C" />
                <entry title="Sandy Bridge-E 32nm Technology" value="" />
            </section>
            <section title="RAM" id="3">
                <entry value="64,0 GB DDR3 @ 1091MHz (11-11-11-31)" />
            </section>
            <section title="Motherboard" id="4">
                <entry title="ASUSTeK COMPUTER INC. P9X79 WS (LGA2011)" value="25 °C" />
            </section>
            <section title="Graphics" id="5">
                <entry title="SyncMaster (1920x1080@60Hz)" value="" />
                <entry title="SyncMaster (1920x1080@60Hz)" value="" />
                <entry title="24W_LCD_TV (1920x1080@50Hz)" value="" />
                <entry title="Microsoft Basic Render Driver" value="" />
                <entry title="NVIDIA GeForce GTX 680" value="" />
            </section>
            <section title="Hard Drives" id="6">
                <entry title="238GB Corsair Performance Pro (SSD)" value="" />
                <entry title="238GB Corsair Performance Pro (SSD)" value="" />
                <entry title="932GB Seagate ST1000NM0011 (SATA)" value="24 °C" />
                <entry title="16764GB Areca ARC-1882-VOL#000 SCSI Disk Device (RAID)" value="" />
            </section>
            <section title="Optical Drives" id="7">
                <entry title="HL-DT-ST BD-RE BH10LS38" value="" />
                <entry title="HL-DT-ST BD-RE BH10LS38" value="" />
            </section>
            <section title="Audio" id="8">
                <entry title="Realtek High Definition Audio" value="" />
            </section>
        </mainsection>
        <mainsection title="Operating System" id="1">
            <entry>
                <entry title="Model" value="MS Windows 8" />
                <entry title="Edition" value="Enterprise" />
                <entry title="Architecture" value="64-bit" />
                <entry title="Service Pack" value="" />
            </entry>
    I have a table in MySQL, where each record contains the name of the .XML file in a field.
    I need to open the .XML file and load relevant data into a specific field for record 1, then repeat for record 2, until all records are filled with the data from the various .XML files. As an example from the above .XML code, I want to extract the BOLD information and get it into fields called:
    os, cpu, ram, mobo, graphics, hard_drives, etc.
    How to do that?

    Not a trivial task, but one that could be done by writing a script that queries the database to get the XML filename and the record's primary key.
    You can then use SimpleXML to open the XML file, extract the values that you need, and store them in variables. Use the variables and primary key to build a SQL query to update the record with the data you have extracted.

  • How to insert large xml data into database tables.

    Hi all,
    iam new to xml. i want to insert data in xml file to my database tables.but the xml file size is very large. performance is also one of the issue. can anybody please tell me the procedure to take xml file from the server and insert into my database tables.
    Thanks in advance

    Unfortunately posting very generic questions like this in the forum tends not to be very productive for you, me or the other people who read the forum. It really helps everyone if you take a little time to review existing posts and their answers before starting new threads which replicate subjects that have already been discussed extensively in previous threads. This allows you to ask more sensible questions (eg, I'm using this approach and encountering this problem) rather than extremely generic questions that you can answer yourself by spending a little time reviewing existings posts or using the forum's search feature.
    Also in future your might want to try being a little more specific before posting questions
    Eg Define "very large". I know of customers who thing very large is 100K, and customers who think 4G is medium. I cannot tell from your post what size your files are.
    What is the content of the file. Is it going to be loaded into a single record, or a a single table, or will it need to be loaded into multiple records in a single table or multiple records in multiple tables ?
    Do you really need to load the data into exsiting relational tables or could your application work with relational views of the XML Content.
    Finally which release of the database are you working with.
    Define performance. Is it reasonable to expect to process this kind of document on this machine (Make, memory, #number of CPUs, CPU Speed, number of discs) in this period of time.
    WRT to your original question. If you take a few minutes to search this forum you will find a very large number of threads with very similar titles to yours. These theads document a number of different approaches that can be used to solve this problem.
    I suggest you start by looking for threads that cover topics like DBMS_XMLSTORE, XMLTable(), Relational Views of XML content, loading XML content in relational tables.

  • Deploying PLL file in Application Server (oracle IAS10g) VERY URGENT

    Hai,
    I have some doubts abt PLL files.(PL sql Libraries)
    I tried to use PLL in Windows and it runs fine.
    When I tries to use that pll on Linux Advanced Server 3 using Oracle IAS10g, The Function in the pll is not accessible.
    What am I doing wrong??
    1.In Which path I have to deploy the PLL file
    2. Is the PLL file is compiled
    3. How to make a Linux Version out of it?
    Our Pll file name is ENCRIPT1.pll
    Th error message is
    PL/SQL ERROR 201,...
    identifier ENCRIPT1 must be declared
    Please Help
    IT IS VERY URGENT

    hai
    As u said, We have compiled the pll file in linux application server The compilation of the pll file was successful. And then compiled the form in linux application server. But still the same problem occurs. We have also checked the case sensitivity. Actually the form is working very well in the Wndows machine.
    The error is
    identifier ENCRYPT MUST BE DECLARED
    PLSQL ERROR 201

Maybe you are looking for