Loading XML file into non-XML table(s)

HI Gentlemen,
I successfully registered my schema and generated an xml-based table and a TYPE. However, I do not have the table that would correspond to this TYPE. How do I get to it? How can I use FTP or HTTP protocol to load actual data from the corresponding .xml file into this table?
Thanks in advance, kind regards from
Miklos HERBOLY

You need to include the XML schema location information in the XML documents to point to the registered XML schema.
For example,
If you register an XML schema to XML DB with "http://www.example.com/po.xsd"
In the XML document, the xml schema location can be:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.com/po.xsd http://www.example.com/po.xsd">
For more information, you can check the example in the following page:
http://www.oracle.com/technology/sample_code/tech/xml/xmldb/index.html
Best,

Similar Messages

  • Need to Load data in XML file into multiple Oracle tables

    Experts
    I want to load data that is stored at XML file into multiple Oracle table using plsql.
    I am novice in this area.Kindly explain in depth or step by step so that i can achive this.
    Thanks in advnace.

    Hi,
    extract your xml and then you can use insert all clause.
    here's very small example on 10.2.0.1.0
    SQL> create table table1(id number,val varchar2(10));
    Table created.
    SQL> create table table2(id number,val varchar2(10));
    Table created.
    SQL> insert all
      2  into table1 values(id,val)
      3  into table2 values(id2,val2)
      4  select extractValue(x.col,'/a/id1') id
      5        ,extractValue(x.col,'/a/value') val
      6        ,extractValue(x.col,'/a/value2') val2
      7        ,extractValue(x.col,'/a/id2') id2
      8  from (select xmltype('<a><id1>1</id1><value>a</value><id2>2</id2><value2>b</value2></a>') col from dual) x;
    2 rows created.
    SQL> select * from table1;
            ID VAL                                                                 
             1 a                                                                   
    SQL> select * from table2;
            ID VAL                                                                 
             2 b                                                                    Ants

  • How do I import one xml file into 3 separate tables in db?

    I need to utilize xslt to import one xml file into 3 separate tables: account, accountAddress, streetAddress
    *Notice the missing values in middleName, accountType
    sample xml
    <account>
    <firstName>Joe</firstName>
    <middleName></middleName>
    <lastName>Torre</lastName>
    <accountAddress>
    <streetAddress>
    <addressLine>myAddressLine1</addressLine>
    <addressLine>myAddressLine2</addressLine>
    </streetAddress>
    <city>myCity</city>
    <state>myState</state>
    <postalCode>mypostalCode</postalCode>
    </accountAddress>
    <accountId>A001</accountId>
    <accountType></accountType>
    <account>
    I need the following 3 results in 3 separate xml files in order for me to upload into my 3 tables.
    Result #1
    <rowset>
    <row>
    <firstName>Joe</firstName>
    <lastName>Torre</lastName>
    <accountId>A001</accountId>
    <row>
    <rowset>
    Result #2
    <rowset>
    <row>
    <addressId>1</address>
    <city>myCity</city>
    <state>myState</state>
    <postalCode>myPostalCode</postalCode>
    <row>
    <rowset>
    Result #3
    <rowset>
    <row>
    <addressId>1</addressId>
    <addressLineSeq>1</addressLineSeq>
    <addressLine>myAddressLine1</addressLine>
    <row>
    <row>
    <addressId>1</addressId>
    <addressLineSeq>2</addressLineSeq>
    <addressLine>myAddressLine2</addressLine>
    <row>
    <rowset>

    Use XSU to store in multiple tables.
    "XSU can only store data in a single table. You can store XML across tables, however, by using the Oracle XSLT processor to transform a document into multiple documents and inserting them separately. You can also define views over multiple tables and perform insertions into the views. If a view is non-updatable (because of complex joins), then you can use INSTEAD OF triggers over the views to perform the inserts."
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14252/adx_j_xsu.htm#i1007013

  • Upload an XML file into the Internal table

    Hi Guys,
    I want to know, how to upload an xml file into the Internal table through ABAP programming

    you just wanted to load the xml file into internal table (as a table of binary strings)or load the xml data mapped to itab row columns
    for the first one you can simply use gui_upload
    and for the second one you need to load the xml file using gui_upload and use XLST program to transform into an itab
    Regards
    Raja

  • Load XML file into oracle xml buffer

    Hi guys,
    I'm a starter in Oracle XML Development, I wander how I can load a xml file into oracle xml buffer(xmlctx* document) through programming with c++ in visual studio.
    When I use orastream structure, it compiled failed.
    Thank you very much!
    Edited by: pomelo on 2010-11-15 下午5:39

    try this
    LOAD DATA
    INFILE '/home/oraread/'
    INTO TABLE xmlloadtable
    (id,
    file_name          filler,
    data_xml          lobfile(file_name) terminated by eof
    )you can add the file_name field as a column to your table between the id and xml column and remove the filler word in the .ldr file if you need to keep the name of the file

  • A query while  importing  an XML file into a Database Table

    Hi,
    I am Creating an ODI Project to import an XML file into a Database Table.With the help of the following link
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/odi_project_xml-to-table/odi_project_xml-to-table.htm
    I am facing a problem while creating Physical Schema for the XML Source Model.
    For the
    Schema(Schema)
    and
    Schema(Work Schema) field they have selected GEO_D.
    What is GEO_D here??
    or
    What I have to select here?
    1) schema of the xml file (NB:-I havn't created any .xsd or .dtd file for my .xml file)
    or
    2)my target servers schema
    Please tell me what I'll do??
    Thanks

    and
    Schema(Work Schema) field they have selected GEO_D.
    What is GEO_D here??This is the schema name which is specified in the XML file .
    What I have to select here?
    1) schema of the xml file (NB:-I havn't created any .xsd or .dtd file for my .xml file)Yes
    2)my target servers schema
    Please tell me what I'll do??
    Thanks

  • Collect data from a dynamic XML file into multiple internal tables

    I need to convert the XML file into multiple internal tables. I tried many links and posts in SDN but still was facing difficulty in achieving this. Can some one tell me where I am going wrong.
    My XML file is of the following type.It is very complex and the dynamice.
    The following tags occur more than once in the XML file. The "I" and "L" tags and its child tags can occur ones or more than once for each XML file and it is not constant. i.e in one file they can occur 1 time and in another they can occur 100 times.
    "I" and "L" are child tags of <C>
    <I>
           <J>10</J>
             <K>EN</K>
      </I>
    <L>
             <J>20</J>
              <N>BB</N>
      </L>
    Tags <C> and <F> occur only ones for each XML file. <C> is the child tag of "A" and "F" is the child tag of <C>.
    I need to collect <D>, <E> in one internal table ITAB.
    I need to collect <G>, <H> in one internal table JTAB.
    I need to collect <J>, <K> in one internal table KTAB.
    I need to collect <J>, <N> in one internal table PTAB.
    Below is the complete XML file.
    ?xml version="1.0" encoding="iso-8859-1" ?>
    <A>
        <B/>
        <C>
           <D>RED</D>
           <E>999</E>
        <F>
           <G>TRACK</G>
           <H>PACK</H>
        </F>
        <I>
           <J>10</J>
           <K>EN</K>
        </I>
        <I>
           <J>20</J>
           <K>TN</K>
        </I>
        <I>
           <J>30</J>
           <K>KN</K>
        </I>
        <L>
           <J>10</J>
           <N>AA</N>
        </L>
        <L>
           <J>20</J>
           <N>BB</N>
        </L>
        <L>
           <J>30</J>
           <N>CC</N>
        </L>
        </C>
      </A>
    With the help of SDN I am able to gather the values of <D> <E> in one internal table.
    Now if I need to gather
    <G>, <H> in one internal table JTAB.
    <J>, <K> in one internal table KTAB.
    <J>, <N> in one internal table PTAB.
    I am unable to do. I am following  XSLT transformation method. If some one has some suggestions. Please help.
    Here is my ABAP program
    TYPE-POOLS abap.
    CONSTANTS gs_file TYPE string VALUE 'C:\TEMP\ABCD.xml'.
    * This is the structure for the data from the XML file
    TYPES: BEGIN OF ITAB,
             D(10) TYPE C,
             E(10) TYPE C,
           END OF ITAB.
    * Table for the XML content
    DATA: gt_itab       TYPE STANDARD TABLE OF char2048.
    * Table and work ares for the data from the XML file
    DATA: gt_ITAB     TYPE STANDARD TABLE OF ts_ITAB,
          gs_ITAB     TYPE ts_ITAB.
    * Result table that contains references
    * of the internal tables to be filled
    DATA: gt_result_xml TYPE abap_trans_resbind_tab,
          gs_result_xml TYPE abap_trans_resbind.
    * For error handling
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    * Get the XML file from your client
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = gs_file
      CHANGING
        data_tab                = gt_itab1
      EXCEPTIONS
        file_open_error         = 1
        file_read_error         = 2
        no_batch                = 3
        gui_refuse_filetransfer = 4
        invalid_type            = 5
        no_authority            = 6
        unknown_error           = 7
        bad_data_format         = 8
        header_not_allowed      = 9
        separator_not_allowed   = 10
        header_too_long         = 11
        unknown_dp_error        = 12
        access_denied           = 13
        dp_out_of_memory        = 14
        disk_full               = 15
        dp_timeout              = 16
        not_supported_by_gui    = 17
        error_no_gui            = 18
        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.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "IITAB".
    GET REFERENCE OF gt_shipment INTO gs_result_xml-value.
    gs_result_xml-name = 'IITAB'.
    APPEND gs_result_xml TO gt_result_xml.
    * Perform the XSLT stylesheet
    TRY.
        CALL TRANSFORMATION zxslt
        SOURCE XML gt_itab1
        RESULT (gt_result_xml).
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    * Now let's see what we got from the file
    LOOP AT gt_ITAB INTO gs_ITAB.
      WRITE: / 'D:', gs_ITAB-D.
      WRITE: / 'E :', gs_ITAB-E.
    ENDLOOP.
    Transformation
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <IITAB>
              <xsl:apply-templates select="//C"/>
            </IITAB>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <item>
          <D>
            <xsl:value-of select="D"/>
          </D>
          <E>
            <xsl:value-of select="E"/>
          </E>
        </item>
      </xsl:template>
    </xsl:transform>
    Now the above pgm and transformation work well and I am able to extract data into the ITAB. Now what changes should I make in transformation and in pgm to collect
    <G>, <H> in one internal table JTAB.
    <J>, <K> in one internal table KTAB.
    <J>, <N> in one internal table PTAB.
    Please help..i am really tring hard to figure this out. I am found lot of threads addressing this issue but not my problem.
    Kindly help.
    Regards,
    VS

    Hi Rammohan,
    Thanks for the effort!
    But I don't need to use GUI upload because my functionality does not require to fetch data from presentation server.
    Moreover, the split command advised by you contains separate fields...f1, f2, f3... and I cannot use it because I have 164 fields.  I will have to split into 164 fields and assign the values back to 164 fields in the work area/header line.
    Moreover I have about 10 such work areas.  so the effort would be ten times the above effort! I want to avoid this! Please help!
    I would be very grateful if you could provide an alternative solution.
    Thanks once again,
    Best Regards,
    Vinod.V

  • Xml data into non-xml database.. solution anyone?

    Hi,
    My current project requires me to store the client's data on our servers. We're using Oracle9i. Daily, I will download the client's data for that day and load it into our database. My problem is that the data file is not a flat file so I can't use sql*loader to load the data. Instead, the data file is an xml file. What is the best way to load xml data into a non-xml database? Are there any tools similar to sql*Loader that will load xml data into non-xml database? Is it the best solution for the client to give me an XML dump of their data to load into our database, or should I request a flat file? My last resort would be to write some sort of a script to parse the xml data into a flat file, and then run it through sql*loader. Is this the best solution? One thing to note is that these files could be very large.
    Thanks in advance.
    -PV

    I assume that just putting the XML file into an
    extremely large VARCHAR field is not what you want.
    Instead, you want to extract data elements from the
    XML and write them to columns in a table in your
    database. Right?Yes. Your assumption is correct.
    It sounds like you already have a script that loads a
    flat file into your database. In that case I would
    write an XSL transformation that converts the client's
    XML into a correctly-formatted flat file.Thank you. I'll look into that. Other suggestions are welcome.

  • Loading an XML file into a database table.

    What is the convenient way to parse XML data present in a data file in server?

    Hi;
    Please check:
    http://riteshkk2000.blogspot.com/2012/01/loadimport-xml-file-into-database-table .html
    http://docs.oracle.com/cd/E18283_01/appdev.112/e16659/xdb03usg.htm#BABIFADB
    http://www.oracle.com/technetwork/articles/quinlan-xml-095823.html
    Regard
    Helios

  • I want to convert XML file into SAP Internal table

    Hi Frndz,
    My xml file is:
    <?xml version="1.0" ?>
    - <!-- Comments: START DATE :1/11/2002 11:26:14 PM
      -->
    - <!-- Comments: RFID Tags read by Mercury4 Copyright Praff@Anantara Solutions
      -->
      <RFIDs><ID>0x303030303030303035050000B5EC</ID><ID>0x300833B2DDD901403505000042E7</ID></RFIDs>
    i want to take those 2 ID's in a internal table that id field is of 28 character type....
    very urgent.
    Thanks,
    Arunprasad.P

    class cl_ixml definition load.
    type-pools: ixml.
    types: begin of t_xml_line,
             data(256) type x,
           end of t_xml_line,
           begin of tsfixml,
             data(1024) type c,
           end of tsfixml.
    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,
          l_xml_line type t_xml_line,
          l_xml_table_size type i.
    data: l_filename type string.
    parameters: pa_file type char1024 default
    'C:\WINDOWS\Desktop\RFIDTags.xml'.
    *Validation of XML file: Only DTD included in xml document is supported
    parameters: pa_val type char1 as checkbox.
    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( ).
    *Create a Parser
    l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                      istream = l_istream
                                      document = l_document ).
    *Validate a document
    if pa_val eq 'X'.
        l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    endif.
    *Parse the stream
    if l_parser->parse( ) ne 0.
      if l_parser->num_errors( ) ne 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
    form get_xml_table changing l_xml_table_size type i
                  l_xml_table type standard table.
    *Local variable declaration
    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 a file from the client's workstation
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = l_filename
        FILETYPE                      = 'BIN'
      IMPORTING
        FILELENGTH                    = l_xml_table_size
      HEADER                        =
      TABLES
        DATA_TAB                      = l_xml_table
    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
    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.
    data: name2 type string,
          name_root type string,
          node_parent type ref to if_ixml_node,
          node_root type ref to if_ixml_node,
          num_children 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.
          num_children = node->num_children( ).
          case node->get_type( ).
          when if_ixml_node=>co_node_element.
           element node
            name = node->get_name( ).
            nodemap = node->get_attributes( ).
            node_root = node->get_root( ).
            name_root = node_root->get_name( ).
            write: / 'ELEMENT :'.
            write: at indent name color col_positive inverse.
            write: 'NUM_CHILDREN:', num_children.
            write: 'ROOT:', name_root.
            node_parent = node->get_parent( ).
            name2 = node_parent->get_name( ).
            write: 'NAME2: ' , name2.
        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 :'.
    node_parent = node->get_parent( ).
    write: at indent value color col_group inverse.
    name2 = node_parent->get_name( ).
    write: 'NAME2: ' , name2.
    endcase.
    *advance to next node
    node = iterator->get_next( ).
    endwhile.
    endform. "process_dom
    Thanks,
    Arunprasad.P

  • How to upload XML file into the internal table in Webdynpro  ABAP ?

    Hi Friends,
    I am not able to upload the XML file into ABAP,can you please help me in solving this issue with the help of source code.
    Regards
    Dinesh

    Hi Dinesh,
    Try go through this program which I had developed earlier. It takes as input an XML file and then breaks it down into name-value pairs of an intrnal table. You need to pass an XML file as input to this program. (I had hard coded the path for my XML file in it. You need to replace it with 1 of your own or you can just delete it and use the browse button to selet the file on your PC)
    Regards,
    Uday
    REPORT  ZUDAY_XML no standard page heading.
    " Internal table to store the XML file in binary mode
    data: begin of it_xml occurs 1,
            c(255) type x,
          end of it_xml,
    " Name-value pairs table rturned by FM SMUM_XML_PARSE
          it_SMUM_XMLTB type SMUM_XMLTB occurs 0 with header line,
    " Table returned by FM SMUM_XML_PARSE for error handling
          it_bapiret2 type bapiret2 occurs 0 with header line.
    " XSTRING variable to be used by FM SCMS_BINARY_TO_XSTRING to hold the XML file in XSTRING format
    data: I_xstring type xstring, 
    " String variable to hold XML file path to pass to GUI_UPLOAD
          I_file_path type string,
    " Variable to store the size of the uploaded binary XML file
          I_LENGTH TYPE I VALUE 0.
    parameters: P_path type IBIPPARMS-PATH default 'C:\Documents and Settings\c5104398\Desktop\flights.xml'.
    " Get the XML file path from the user
    at selection-screen on value-request for P_path.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          FILE_NAME = P_PATH.

  • Merging two xml files into single xml file

    i hav to merge 2 xml files in to single xml file
    my xml files are
    input1.xml
    <?xml version="1.0"?>
    <PreVCD>
    <component name="stack">
    <subpath path="stack_environment">
    <variable var="ins" symbol="!" wireonbus="1"/>
    </subpath>
    </component>
    <dump>
    <time t="0">
    <data>
    <symbol sign="!" value="0"/>
    </data>
    </time>
    <time t="10">
    <data>
    <symbol sign="!" value="1"/>
    </data>
    </time>
    <time t="25">
    <data>
    <symbol sign="!" value="0"/>
    </data>
    </time>
    </dump>
    </PreVCD>
    input2.xml
    <?xml version="1.0"?>
    <PreVCD>
    <component name="stack">
    <subpath path="stack_behavior">
    <variable var="i" symbol="@" bussize="1"/>
    </subpath>
    </component>
    <dump>
    <time t="0">
    <data>
    <symbol sign="@" value="0"/>
    </data>
    </time>
    <time t="5">
    <data>
    <symbol sign="@" value="1"/>
    </data>
    </time>
    <time t="10">
    <data>
    <symbol sign="@" value="0"/>
    </data>
    </time>
    <time t="20">
    <data>
    <symbol sign="@" value="1"/>
    </data>
    </time>
    </dump>
    </PreVCD>
    The ouput should look like:
    <PreVCD>
    <component name="stack">
    <subpath path="stack_behavior">
    <variable var="i" symbol="@" bussize="1"/>
    </subpath>
    <subpath path="stack_environment">
    <variable var="ins" symbol="!" wireonbus="1"/>
    </subpath>
    </component>
    <dump>
    <time t="0">
    <data>
    <symbol sign="@" value="0"/>
    <symbol sign="!" value="0"/>
    </data>
    </time>
    <time t="5">
    <data>
    <symbol sign="@" value="1"/>
    </data>
    </time>
    <time t="10">
    <data>
    <symbol sign="@" value="0"/>
    <symbol sign="!" value="1"/>
    </data>
    </time>
    <time t="20">
    <data>
    <symbol sign="@" value="1"/>
    </data>
    </time>
    <time t="25">
    <data>
    <symbol sign="!" value="0"/>
    </data>
    </time>
    </dump>
    </PreVCD>
    thanks for any advice

    Merge xml documents with the xslt document() function.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet
    version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" />
    <xsl:template match="/">
    <xsl:copy-of select="*"/>
    <xsl:copy-of select="document('input2.xml')"/>
    </xsl:template>
    </xsl:stylesheet>

  • Approach to parse large number of XML files into the relational table.

    We are exploring the option of XML DB for processing a large number of files coming same day.
    The objective is to parse the XML file and store in multiple relational tables. Once in relational table we do not care about the XML file.
    The file can not be stored on the file server and need to be stored in a table before parsing due to security issues. A third party system will send the file and will store it in the XML DB.
    File size can be between 1MB to 50MB and high performance is very much expected other wise the solution will be tossed.
    Although we do not have XSD, the XML file is well structured. We are on 11g Release 2.
    Based on the reading this is what my approach.
    1. CREATE TABLE XML_DATA
    (xml_col XMLTYPE)
    XMLTYPE xml_col STORE AS SECUREFILE BINARY XML;
    2. Third party will store the data in XML_DATA table.
    3. Create XMLINDEX on the unique XML element
    4. Create views on XMLTYPE
    CREATE OR REPLACE FORCE VIEW V_XML_DATA(
       Stype,
       Mtype,
       MNAME,
       OIDT
    AS
       SELECT x."Stype",
              x."Mtype",
              x."Mname",
              x."OIDT"
       FROM   data_table t,
              XMLTABLE (
                 '/SectionMain'
                 PASSING t.data
                 COLUMNS Stype VARCHAR2 (30) PATH 'Stype',
                         Mtype VARCHAR2 (3) PATH 'Mtype',
                         MNAME VARCHAR2 (30) PATH 'MNAME',
                         OIDT VARCHAR2 (30) PATH 'OID') x;
    5. Bulk load the parse data in the staging table based on the index column.
    Please comment on the above approach any suggestion that can improve the performance.
    Thanks
    AnuragT

    Thanks for your response. It givies more confidence.
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    Example XML
    <SectionMain>
    <SectionState>Closed</SectionState>
    <FunctionalState>CP FINISHED</FunctionalState>
    <CreatedTime>2012-08</CreatedTime>
    <Number>106</Number>
    <SectionType>Reel</SectionType>
    <MachineType>CP</MachineType>
    <MachineName>CP_225</MachineName>
    <OID>99dd48cf-fd1b-46cf-9983-0026c04963d2</OID>
    </SectionMain>
    <SectionEvent>
    <SectionOID>99dd48cf-2</SectionOID>
    <EventName>CP.CP_225.Shredder</EventName>
    <OID>b3dd48cf-532d-4126-92d2</OID>
    </SectionEvent>
    <SectionAddData>
    <SectionOID>99dd48cf2</SectionOID>
    <AttributeName>ReelVersion</AttributeName>
    <AttributeValue>4</AttributeValue>
    <OID>b3dd48cf</OID>
    </SectionAddData>
    - <SectionAddData>
    <SectionOID>99dd48cf-fd1b-46cf-9983</SectionOID>
    <AttributeName>ReelNr</AttributeName>
    <AttributeValue>38</AttributeValue>
    <OID>b3dd48cf</OID>
    <BNCounter>
    <SectionID>99dd48cf-fd1b-46cf-9983-0026c04963d2</SectionID>
    <Run>CPFirstRun</Run>
    <SortingClass>84</SortingClass>
    <OutputStacker>D2</OutputStacker>
    <BNCounter>54605</BNCounter>
    </BNCounter>
    I was not aware of Virtual column but looks like we can use it and avoid creating views by just inserting directly into
    the staging table using virtual column.
    Suppose OID id is the unique identifier of each XML FILE and I created virtual column
    CREATE TABLE po_Virtual OF XMLTYPE
    XMLTYPE STORE AS BINARY XML
    VIRTUAL COLUMNS
    (OID_1 AS (XMLCAST(XMLQUERY('/SectionMain/OID'
    PASSING OBJECT_VALUE RETURNING CONTENT)
    AS VARCHAR2(30))));
    1. My question is how then I will write this query by NOT USING COLMUN XML_COL
    SELECT x."SECTIONTYPE",
    x."MACHINETYPE",
    x."MACHINENAME",
    x."OIDT"
    FROM po_Virtual t,
    XMLTABLE (
    '/SectionMain'
    PASSING t.xml_col                          <--WHAT WILL PASSING HERE SINCE NO XML_COL
    COLUMNS SectionType VARCHAR2 (30) PATH 'SectionType',
    MachineType VARCHAR2 (3) PATH 'MachineType',
    MachineName VARCHAR2 (30) PATH 'MachineName',
    OIDT VARCHAR2 (30) PATH 'OID') x;
    2. Insetead of creating the view then Can I do
    insert into STAGING_table_yyy ( col1 ,col2,col3,col4,
    SELECT x."SECTIONTYPE",
    x."MACHINETYPE",
    x."MACHINENAME",
    x."OIDT"
    FROM xml_data t,
    XMLTABLE (
    '/SectionMain'
    PASSING t.xml_col                         <--WHAT WILL PASSING HERE SINCE NO XML_COL
    COLUMNS SectionType VARCHAR2 (30) PATH 'SectionType',
    MachineType VARCHAR2 (3) PATH 'MachineType',
    MachineName VARCHAR2 (30) PATH 'MachineName',
    OIDT VARCHAR2 (30) PATH 'OID') x
    where oid_1 = '99dd48cf-fd1b-46cf-9983';<--VIRTUAL COLUMN
    insert into STAGING_table_yyy ( col1 ,col2,col3
    SELECT x."SectionOID",
    x."EventName",
    x."OIDT"
    FROM xml_data t,
    XMLTABLE (
    '/SectionMain'
    PASSING t.xml_col                         <--WHAT WILL PASSING HERE SINCE NO XML_COL
    COLUMNS SectionOID PATH 'SectionOID',
    EventName VARCHAR2 (30) PATH 'EventName',
    OID VARCHAR2 (30) PATH 'OID',
    ) x
    where oid_1 = '99dd48cf-fd1b-46cf-9983';<--VIRTUAL COLUMN
    Same insert for other tables usind the OID_1 virtual coulmn
    3. Finaly Once done how can I delete the XML document from XML.
    If I am using virtual column then I beleive it will be easy
    DELETE table po_Virtual where oid_1 = '99dd48cf-fd1b-46cf-9983';
    But in case we can not use the Virtual column how we can delete the data
    Thanks in advance
    AnuragT

  • How to parse and retrieve records from xml files into columns in Table

    Hi
    I attached the thing what i tried.
    Table to hold the XML COntent:
    create table xmlfile(xml_con sys.xmltype);
    Inserting Xml file content into the Above table:
    insert into xmlfile values(sys.xmltype.CreateXml('<Root><name>RAM</name><age>23</age></Root>'))
    SQL> select * from xmlfile;
    XML_CON
    <Root>
    <name>RAM</name>
    <age>23</age>
    </Root>
    SQL> select extractValue(xml_con, '/Root/name') content from xmlfile;
    CONTENT
    RAM
    This one works fine
    But if the file content is as below( contains MUltiple Records)
    insert into xmlfile values(sys.xmltype.CreateXml('<Root><Record><name>RAM</name><age>23</age></Record><Record><name>SAM</name><age>23</age></Record></Root>'))
    SQL> select extractValue(xml_con, '/Root/Record/name') content from xmlfile;
    ERROR at line 1:
    ORA-19025: EXTRACTVALUE returns value of only one node
    Can anyone help me 4 this issue-How to extract multiple records from the XML file inthis manner(from PL/SQL without using JAVA)
    OR
    If there is anyother way to do this please tell me?

    SQL> SELECT EXTRACTVALUE (COLUMN_VALUE, '//name') NAME,
           EXTRACTVALUE (COLUMN_VALUE, '//age') age
      FROM TABLE
              (XMLSEQUENCE
                  (EXTRACT
                      (XMLTYPE
                          ('<Root>
                              <Record>
                                <name>RAM</name>
                                <age>23</age>
                              </Record>
                              <Record>
                                <name>SAM</name>
                                <age>23</age>
                              </Record>
                            </Root>'
                       '/Root/Record'
    NAME       AGE      
    RAM        23       
    SAM        23       
    2 rows selected.

  • Loading multiple files into a target table parallely

    Hi
    We are building an interface to load from flat files to an Oracle table. The input can be more than one files all of th same format. I have created a variable for the flat file data store. I have created 2 packages
    In package 1
    I have put odi file wait to trigger whenever files come into the directory . The list of files is written to a metadata table table. A procedure is triggered which picks a record from the metadata table and calls the scenario for calls package 2 by passing the selected record as parameter.
    In package 2
    The variable value is set to the parameter passed from package 1 procedure
    The interface runs to load the flat file = to the variable value into the target table
    Now if the directory has more than one flat file , the procedure in package 1 calls the package 2 scenario more than one times. This causes sequential load from each flat file to the target table. Is there a way wherein the multiple flat files can be loaded in parallel to the same target table? At this point ,I am not sure if this is possible as there is only one interface and one variable for the source file

    As per your requirement , your process seems to be always continues like a loop[ reason being as you have mentiond - I dont want to wait for all files to come in. As soon as a file comes in the file has to be loaded.  ] .
    You can solve the issue of file capture using OdiFileWait to let you know when the files have arrived.
    Tell me this what do you plan to when the File loading is complete, will that be in the same folder and when new files come will that update with the same name or different name , becuase irresptive of same file or different if the files are present in the same folder after loading into target , then we might do repetitive loading of files. Please tell me how do you plan to handle this.
    When you have plan to use LKM file to sql , what is the average number of source records coming into each sample files. ?
    Just to add to above question , what is the average numner of parallel loads you are expecting and what is the time interval between each paralled loading you are expecting.

Maybe you are looking for