Loading this xml data into tables

Hello,
I am having a problem loading this XML file into tables. The xml file structure is
<FILE>
<ACCESSION>
some ids
<INSTANCE>
some data
<VARIATION
</VARIATION>
<VARIATION>
</VARIATION> variation gets repeated a number of times
<ASSEMBLY>
</ASSEMBLY>
<ASSEMBLY>
</ASSEMBLY> Assembly gets repeated a number of times.
</INSTANCE>
</ACCESSION>
</FILE>
I created a table which has the structure:
create table accession(
accession_id varchar2(20),
Instance instance_type);
create or replace type instance_type as object
(method varchar2(20),
class varchar2(20),
source varchar2(20),
num_char number(10),
variation variation_type,
assembly assembly_type)
create or replace type variation_type as object
(value varchar2(2),
count number(10),
frequency number(10),
pop_id varchar2(10)
Created a similiar type for assembly.
When I load it, I could only store the first variation data but not the subsequent ones. Similarly for assembly I could only store the first data but not the subsequent ones.
Could anyone let me know how I could store this data into tables? I have also included a sample XML file in this message.
Thank You for your help.
Rama.
Here is the sample xml file.
<?xml version="1.0" ?>
- <FILE>
- <ACCESSION>
<ACCESSION_ID>accid1</ACCESSION_ID>
- <INSTANCE>
<METHOD>method1</METHOD>
<CLASS>class1</CLASS>
<SOURCE>source1</SOURCE>
<NUM_CHAR>40</NUM_CHAR>
- <VARIATION>
<VALUE>G</VALUE>
<COUNT>5</COUNT>
<FREQUENCY>66</FREQUENCY>
<POP1>pop1</POP1>
<POP2>pop1</POP2>
</VARIATION>
<VARIATION>
<VALUE>C</VALUE>
<COUNT>2</COUNT>
<FREQUENCY>33</FREQUENCY>
<POP_ID1>pop2</POP_ID1>
</VARIATION>
- <ASSEMBLY>
<ASSEMBLY_ID>1</ASSEMBLY_ID>
<BEGIN>180</BEGIN>
<END>180</END>
<TYPE>2</TYPE>
<ORI>-</ORI>
<OFFSET>0</OFFSET>
</ASSEMBLY>
- <ASSEMBLY>
<ASSEMBLY_ID>2</ASSEMBLY_ID>
<BEGIN>235</BEGIN>
<END>235</END>
<TYPE>2</TYPE>
<ORI>-</ORI>
<OFFSET>0</OFFSET>
</ASSEMBLY>
</INSTANCE>
</ACCESSION>
</FILE>

Hello,
I could figure out how to load this XML file by using cast(multiset(
So never mind.
Thank You.
Rama.

Similar Messages

  • 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

  • How to Dump XML data into table

    Hi All,
    We have one schema on a server.
    We have created the same schema with only table structures on another new server.
    Now we got the data from the original schema as XML files corresponding to each table.
    For Example, we have Employee table created newly on a new server. Now we have the XML file which has Employee data. We have to dump this XML data into new EMPLOYEE table.
    We have to dump these XML files data into corresponding tables.
    How can we achieve this?
    Please help me..
    Thanks in advance

    Look at this example:
    Assume you have the following XML in a tempxml table (tempxml could be an external table):
    create table tempxml (xml xmltype);
    insert into tempxml values (xmltype(
    '<?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <EMPNO>7369</EMPNO>
      <ENAME>SMITH</ENAME>
      <JOB>CLERK</JOB>
      <MGR>7902</MGR>
      <HIREDATE>17-DEC-80</HIREDATE>
      <SAL>800</SAL>
      <DEPTNO>20</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7499</EMPNO>
      <ENAME>ALLEN</ENAME>
      <JOB>SALESMAN</JOB>
      <MGR>7698</MGR>
      <HIREDATE>20-FEB-81</HIREDATE>
      <SAL>1600</SAL>
      <COMM>300</COMM>
      <DEPTNO>30</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7521</EMPNO>
      <ENAME>WARD</ENAME>
      <JOB>SALESMAN</JOB>
      <MGR>7698</MGR>
      <HIREDATE>22-FEB-81</HIREDATE>
      <SAL>1250</SAL>
      <COMM>500</COMM>
      <DEPTNO>30</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7566</EMPNO>
      <ENAME>JONES</ENAME>
      <JOB>MANAGER</JOB>
      <MGR>7839</MGR>
      <HIREDATE>02-APR-81</HIREDATE>
      <SAL>2975</SAL>
      <DEPTNO>20</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7654</EMPNO>
      <ENAME>MARTIN</ENAME>
      <JOB>SALESMAN</JOB>
      <MGR>7698</MGR>
      <HIREDATE>28-SEP-81</HIREDATE>
      <SAL>1250</SAL>
      <COMM>1400</COMM>
      <DEPTNO>30</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7698</EMPNO>
      <ENAME>BLAKE</ENAME>
      <JOB>MANAGER</JOB>
      <MGR>7839</MGR>
      <HIREDATE>01-MAY-81</HIREDATE>
      <SAL>2850</SAL>
      <DEPTNO>30</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7782</EMPNO>
      <ENAME>CLARK</ENAME>
      <JOB>MANAGER</JOB>
      <MGR>7839</MGR>
      <HIREDATE>09-JUN-81</HIREDATE>
      <SAL>2450</SAL>
      <DEPTNO>10</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7788</EMPNO>
      <ENAME>SCOTT</ENAME>
      <JOB>ANALYST</JOB>
      <MGR>7566</MGR>
      <HIREDATE>19-APR-87</HIREDATE>
      <SAL>3000</SAL>
      <DEPTNO>20</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7839</EMPNO>
      <ENAME>KING</ENAME>
      <JOB>PRESIDENT</JOB>
      <HIREDATE>17-NOV-81</HIREDATE>
      <SAL>5000</SAL>
      <DEPTNO>10</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7844</EMPNO>
      <ENAME>TURNER</ENAME>
      <JOB>SALESMAN</JOB>
      <MGR>7698</MGR>
      <HIREDATE>08-SEP-81</HIREDATE>
      <SAL>1500</SAL>
      <COMM>0</COMM>
      <DEPTNO>30</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7876</EMPNO>
      <ENAME>ADAMS</ENAME>
      <JOB>CLERK</JOB>
      <MGR>7788</MGR>
      <HIREDATE>23-MAY-87</HIREDATE>
      <SAL>1100</SAL>
      <DEPTNO>20</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7900</EMPNO>
      <ENAME>JAMES</ENAME>
      <JOB>CLERK</JOB>
      <MGR>7698</MGR>
      <HIREDATE>03-DEC-81</HIREDATE>
      <SAL>950</SAL>
      <DEPTNO>30</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7902</EMPNO>
      <ENAME>FORD</ENAME>
      <JOB>ANALYST</JOB>
      <MGR>7566</MGR>
      <HIREDATE>03-DEC-81</HIREDATE>
      <SAL>3000</SAL>
      <DEPTNO>20</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7934</EMPNO>
      <ENAME>MILLER</ENAME>
      <JOB>CLERK</JOB>
      <MGR>7782</MGR>
      <HIREDATE>23-JAN-82</HIREDATE>
      <SAL>1300</SAL>
      <DEPTNO>10</DEPTNO>
    </ROW>
    </ROWSET>'));You can insert into an empty EMP2 table this way:
    SQL> insert into emp2
      2  select myemp.empno, myemp.ename, myemp.job, myemp.mgr,
      3         to_date(myemp.hiredate,'dd-mon-yy'), myemp.sal,
      4         myemp.comm, myemp.deptno
      5  from tempxml x, xmltable('/ROWSET/ROW'
      6                           PASSING x.xml
      7                           COLUMNS
      8                             empno number PATH '/ROW/EMPNO',
      9                             ename varchar2(10) PATH '/ROW/ENAME',
    10                             job   varchar2(9) PATH '/ROW/JOB',
    11                             mgr   number PATH '/ROW/MGR',
    12                             hiredate varchar2(9) PATH '/ROW/HIREDATE',
    13                             sal    number PATH '/ROW/SAL',
    14                             comm   number PATH '/ROW/COMM',
    15                             deptno number PATH '/ROW/DEPTNO'
    16                            ) myemp;
    14 rows created.
    SQL> select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    14 rows selected.Max
    http://oracleitalia.wordpress.com

  • Load xml data into table

    Hi all,
    I have an XML file (emp.xml) with below data:
    - <root>
    - <row>
    <lastname>steve</lastname>
    <Age>30</Age>
    </row>
    - <row>
    <lastname>Paul</lastname>
    <Age>26</Age>
    </row>
    </root>
    I'd like to create a stored procedure to store the xml data into EMP table.
    EMP
    LastName Age
    Steve 30
    Paul 26
    I tried to look all the related threads in this forum, but couldn't find the right thread. Any help is greatly appreciated. Thanks

    With
    SQL>  select * from xmltable('root/row' passing xmltype('<root>
    <row>
    <lastname>steve</lastname>
    <Age>30</Age>
    </row>
    <row>
    <lastname>Paul</lastname>
    <Age>26</Age>
    </row>
    </root>') columns lastname path 'lastname',
                       Age path 'Age')
    LASTNAME   AGE      
    steve      30       
    Paul       26   you can now simple do a
    insert into emp as select ....

  • How to Store an XML Data into Table?

    Hi All,
    My Requirement is "I Have an XML File (or) XML Data as CLOB, now I should decode this XML Data and find the equivalent data for columns in a table and then store that in a relational table",
    Would be greatful if any one can provide me a feasible solution (or) good link where I can get this information with examples.
    Thanks in advance,
    Sunil N

    Or,
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.03
    satyaki>
    satyaki>
    satyaki>drop table dump_tab;
    Table dropped.
    Elapsed: 00:00:01.08
    satyaki>
    satyaki>create table dump_tab
      2   (
      3      raw_xml  clob
      4   );
    Table created.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>desc dump_tab;
    Name                                      Null?    Type
    RAW_XML                                            CLOB
    satyaki>
    satyaki>
    satyaki>insert into dump_tab
      2  select yy.rxml
      3  from (
      4        select ('  <data>
      5           <var name="document">
      6           <string>Sales Order</string>
      7           </var>
      8           <var name="results">
      9           <recordset rowcount="2">
    10           <field name="sales_num">
    11           <string>12345</string>
    12           <string>60192</string>
    13           </field>
    14           <field name="ord_qty">
    15           <string>10</string>
    16           <string>50</string>
    17           </field>
    18           </recordset>
    19           </var>
    20           </data>'
    21      ) rxml from dual
    22     ) yy;
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>commit;
    Commit complete.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>create table results
      2    (
      3      serial_no    number(5),
      4      sales_num    number(7),
      5      ord_qty      number(10)
      6    );
    Table created.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>desc results;
    Name                                      Null?    Type
    SERIAL_NO                                          NUMBER(5)
    SALES_NUM                                          NUMBER(7)
    ORD_QTY                                            NUMBER(10)
    satyaki>
    satyaki>select * from dump_tab;
    RAW_XML
      <data>
             <var name="document">
             <string>Sales Order</string>
             </var>
             <var name="results">
             <recordset rowcount="2">
             <field name="sales_num">
             <string>12345</string>
             <string>60192</string>
             </field>
             <field name="ord_qty">
    RAW_XML
             <string>10</string>
             <string>50</string>
             </field>
             </recordset>
             </var>
             </data>
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>
    satyaki>ed
    Wrote file afiedt.buf
      1  insert into results(serial_no,sales_num,ord_qty)
      2  with t
      3    as (
      4         select xmltype(raw_xml) xml from dump_tab
      5       ),
      6    t1 as (select rownum rn, t1.column_value.extract('*/text()') sales_num from t t, table(xmlsequence(t.xml.extract('//field[@name="sales_num"]/string'))) t1),
      7    t2 as (select rownum rn, t2.column_value.extract('*/text()') ord_qty   from t t, table(xmlsequence(t.xml.extract('//field[@name="ord_qty"]/string'))) t2)
      8    select t1.rn x,
      9           to_number(regexp_replace(xmlelement("e",sales_num).getstringval(),'<(|/)e>','')) sales_num
    10           to_number(regexp_replace(xmlelement("d",ord_qty).getstringval(),'<(|/)d>','')) ord_qty
    11      from t1,t2
    12*    where t1.rn = t2.rn
    satyaki>/
    2 rows created.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>select * from results;
    SERIAL_NO  SALES_NUM    ORD_QTY
             1      12345         10
             2      60192         50
    Elapsed: 00:00:00.00
    satyaki>Regards.
    Satyaki De.

  • Load an XML file into table(s)

    Hi ,
    I have to load data from an xml file into an Oracle DB but I never used this king of process before. The purpose is to use as much as possible Oracle standard features ( stored procedures , functions , API's ).
    Can someone explain me in simple explanations how to do it ? Thanks in advance for your help.
    The XML must not be stored in the database , only the final tables
    Values can be inserted , updated , or deleted from the final tables
    Here are the versions of the tools I am using :
    Oracle RDBMS : 10.2.0.4.0
    Oracle Applications : 11.5.10.2
    Toad : 9.5.0.31
    SQL Plus : 8.0.6.0.0
    The header of the xsd :
    <?xml version="1.0" encoding="windows-1252" ?>
    - <!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by erik de bruyn (Graydon)
    -->
    - <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3schools.com" targetNamespace="http://www.w3schools.com" elementFormDefault="qualified">
    An extract of the xml :
    <?xml version="1.0" encoding="windows-1252" ?>
    - <GraydonBeDialogue>
    <TransactionCode>RTB</TransactionCode>
    - <Table ClassTable="Country">
    - <TableEntry>
    <TableLanguage>N</TableLanguage>
    <TableCode>AD</TableCode>
    <TableValue>Andorra</TableValue>
    </TableEntry>
    - <TableEntry>
    <TableLanguage>N</TableLanguage>
    <TableCode>AE</TableCode>
    <TableValue>Verenigde Arabische Emiraten</TableValue>
    </TableEntry>
    </Table>
    - <Table ClassTable="Summons">
    - <TableEntry>
    <TableLanguage>N</TableLanguage>
    <TableCode>D</TableCode>
    <TableValue>De dagvaarding is het gevolg</TableValue>
    </TableEntry>
    - <TableEntry>
    <TableLanguage>N</TableLanguage>
    <TableCode>S</TableCode>
    <TableValue>Doorgehaald bij de arbeidsrechtbank</TableValue>
    </TableEntry>
    </Table>
    </GraydonBeDialogue>
    The result I would have :
    Two tables ( Country and Summons ) , each containing 3 columns ( TableLanguage , TableCode , TableValue ) :
    Table Country : TableLanguage TableCode TableValue
    N AD Andorra
    N AE Verenigde Arabische Emiraten
    Table Summons : TableLanguage TableCode TableValue
    N D De dagvaarding is het gevolg
    N S Doorgehaald bij de arbeidsrechtbank

    for table Country
    create table Country as
    with t as (
        select
        xmltype (
            '<?xml version="1.0" encoding="windows-1252" ?>
    <GraydonBeDialogue>
         <TransactionCode>RTB</TransactionCode>
              <Table ClassTable="Country">
                   <TableEntry>
                        <TableLanguage>N</TableLanguage>
                        <TableCode>AD</TableCode>
                        <TableValue>Andorra</TableValue>
                   </TableEntry>
                   <TableEntry>
                        <TableLanguage>N</TableLanguage>
                        <TableCode>AE</TableCode>
                        <TableValue>Verenigde Arabische Emiraten</TableValue>
                   </TableEntry>
              </Table>
              <Table ClassTable="Summons">
                   <TableEntry>
                        <TableLanguage>N</TableLanguage>
                        <TableCode>D</TableCode>
                        <TableValue>De dagvaarding is het gevolg</TableValue>
                   </TableEntry>
                   <TableEntry>
                        <TableLanguage>N</TableLanguage>
                        <TableCode>S</TableCode>
                        <TableValue>Doorgehaald bij de arbeidsrechtbank</TableValue>
                   </TableEntry>
              </Table>
    </GraydonBeDialogue>') as xml       
        from dual
    select x.TableLanguage, x.TableCode, x.TableValue
    from t
    ,xmltable('/GraydonBeDialogue/Table[@ClassTable="Country"]/TableEntry'
                       passing t.xml
                       columns TableLanguage varchar2(50) path '/TableEntry/TableLanguage'
                       , TableCode varchar2(50) path '/TableEntry/TableCode'
                       , TableValue varchar2(50) path '/TableEntry/TableValue'                        
                              ) x

  • Xml Data into Table Within an Oracle Database

    With no oracle or database background, I have been tasked to figure out how to analyze reading values within xml files. I initially started by writing c# code to read through the xml files, pull out the values I need and summarize the results. Unfortunately, this took atleast 5 hours to open all the xml files and summarize the results for a small portion of EndPointChannelId's and xml files. I decided to store all the reading values within the xml files into a table so I can use SQL queries to do the analysis instead of having to process through all the files each time. Using the same c# code as before, I have used insert and update sql statements to insert the reading values into a table. To my dismay, it takes about 3 and a half hours to import 1 file where there is 20 files a day :S. There are over 19,000 ChannelID's per file. I am currently using SQL Developer to view the data and have noticed XML Schemas and XML DB Repository but am not sure if that would be the best approach to my problem. I need to increase the efficiency of the import process but I am having difficulties trying to figure out how to go about it. Do you have any suggestions on where I should go from here? What is the most efficient way you have used to import xml files into a table structure. I would greatly appreciate any ideas!
    Below is a portion of the xml file that I am working with.
    - <Channel ReadingsInPulse="false" IsRegister="false" IsReadingDecoded="true" MarketType="Electric" IntervalLength="60">
    <ChannelID EndPointChannelID="57432:1" />
    - <ContiguousIntervalSets>
    - <ContiguousIntervalSet NumberOfReadings="6">
    <TimePeriod EndRead="22467.80" EndTime="2013-05-09T13:00:00Z" StartTime="2013-05-09T07:00:00Z" />
    - <Readings>
    <Reading Value="0.31" />
    <Reading Value="0.4" />
    <Reading Value="0.16" />
    <Reading Value="0.32" />
    <Reading Value="0.09" />
    <Reading Value="0.35" />
    </Readings>
    </ContiguousIntervalSet>
    </ContiguousIntervalSets>
    </Channel>

    Hi,
    Welcome to the forums,
    what i understand from your Post, You want to read/analyze some value from xml files. and for this you want to import it in database and then perform some Query on that file for easy work.
    you can choose the External table concept for reading/ Query those files
    check this link may it help you
    Creation of External table by using XML files.
    http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables013.htm

  • Loading xml data into table

    When I try to load data following the document
    http://metalink.oracle.com/metalink/plsql/ml2_documents.showNOT?p_id=121405.1&p_showHeader=1&p_showHelp=0
    I get these messages:
    SQL> exec loadxml;
    ERROR:
    ORA-06550: line 1, column 29:
    PLS-00553: character set name is not recognized
    ORA-06550: line 0, column 0:
    PL/SQL: Compilation unit analysis terminated
    I have created example.xml file from the example shown in the above document, as well as procedule loaxml from the document. I would appreciate if you could point out what could be wrong. How do I verify that jserver and XML-SQL (XSU) Utility is installed?

    I did some basic testing. I logged in as SYS-user.
    SELECT directory_name,directory_path
    FROM all_directories where directory_name like 'XML%';
    gives the directory in db-server ok:
    DIRECTORY_NAME ...... DIRECTORY_PATH
    XML_FILES ................... D:\OWB_Files
    If i run this:
    SELECT DBMS_LOB.getLength( BFileName('XML_FILES','asi.xml'))
    AS length FROM dual;
    i get this:
    ERROR at line 1:
    ORA-22288: file or LOB operation GETLENGTH failed
    The system cannot find the file specified.ORA-06512: at "SYS.DBMS_LOB", line 566
    I made a copy of one xml-file to name asi.xml and grated to USER all priviledges in Windows Explorer. I also run this in SQL*Plus: grant all on directory XML_FILES to public;
    If i made a typo to directory name 'XML_FILES' -> 'XML_zzzFILES' i get different error message: ORA-22285: non-existent directory or file for GETLENGTH operation.
    So, directory is okay? But all the files are some in the shadows? Once again - run out of ideas.

  • XML Data into table

    Hello
    Sorry, for the next question, but it doens't wort :-(...
    I want to insert this xmldata into a table:
    <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
    <aps:Operations xmlns:aps="Software" aps_version="V4.02-03.00" aps_versionl="4020300">
    <Event>
    <name>Dispatcher</name>
    <dtsysl>20110428</dtsysl>
    <hrsysl>95835</hrsysl>
    <dtcptl>20110428</dtcptl>
    <nusesi>1</nusesi>
    <DSP>
    <step>WAIT</step>
    <state>Start</state>
    </DSP>
    </Event>
    </aps:Operations>
    CREATE OR REPLACE DIRECTORY test_dir AS '/oracle/temp/';
    CREATE TABLE test_xml
    (name VARCHAR (40),
    dtsysl DATE,
    hrsysl NUMBER,
    dtcptl DATE,
    nusesi NUMBER,
    step VARCHAR (40),
    state VARCHAR (40) );
    INSERTINTO test_xml (name, dtsysl,hrsysl,dtcptl,nusesi,step,state)
    SELECT *
    FROM XMLTABLE (
    '/ROWSET/ROW'
    PASSING xmltype (BFILENAME (TEST_DIR', 'test.xml'), NLS_CHARSET_ID ('CHAR_CS'))
    COLUMNS name VARCHAR (40) path 'name',
    dtsysl DATE path 'dtsysl',
    hrsysl NUMBER path 'hrsysl',
    dtcptl DATE path 'dtcptl',
    nusesi NUMBER path 'nusesi',
    step VARCHAR (40) path 'step',
    state VARCHAR (40) path 'state');
    The message is always "0 rows inserted".
    Thanks for your support.
    roger
    Edited by: Street on 28.04.2011 04:31
    Edited by: Street on 28.04.2011 04:36

    Apparently, you're using sample code from another example?
    The problem is the use of "/ROWSET/ROW", there's no such path in the XML document, hence XMLTable returning nothing.
    In your case the correct query would be :
    SELECT *
    FROM XMLTABLE (
      XMLNamespaces('Software' as "aps"),
      '/aps:Operations/Event'
      PASSING xmltype (BFILENAME ('TEST_DIR', 'test.xml'), NLS_CHARSET_ID ('CHAR_CS'))
      COLUMNS name   VARCHAR (40) path 'name',
              dtsysl DATE         path 'dtsysl',
              hrsysl NUMBER       path 'hrsysl',
              dtcptl DATE         path 'dtcptl',
              nusesi NUMBER       path 'nusesi',
              step   VARCHAR (40) path 'DSP/step',
              state  VARCHAR (40) path 'DSP/state'
    );See the XQuery expression "/aps:Operations/Event", it represents the access path of the element you consider as the record of data.
    Hope that helps.

  • Loading a XML-document into tables

    Hi,
    I have created a view for the tables below.
    Table Book with columns:
    - Book_ID
    - Book_Name
    - Ref_To_Price ( -> is a reference to Table Price (Price_ID))
    Table Price with columns:
    - Price_ID
    - Price_DM
    SQL-Syntax:
    "create view Bookprice as select Book_ID, Book_Name, Ref_To_Price, Price_ID, Price_DM from Book, Price where Ref_To_Price = Price_ID; "
    XML-Document:
    <?xml version="1.0" encoding="UTF-16"?>
    <!DOCTYPE ANWENDUNGEN SYSTEM "file:/E:/book.dtd">
    <!-- ?xml-stylesheet href="book.xsl" type="text/xsl"? -->
    <ROOTDOC>
    <ROW>
    <BOOK_ID>66-77</BOOK_ID>
    <BOOK_NAME>JavaScript</BOOK_NAME>
    <REF_TO_PRICE>12</REF_TO_PRICE>
    <PRICE_ID>12</PRICE_ID>
    <PRICE_DM>25.50DM</PPRICE_DM>
    </ROW>
    </ROOTDOC>
    If I use the XML SQL Utility to insert the XML-Document, the following error message came up:
    " Exception in thread "main" oracle.xml.sql.OracleXMLSQLException: java.sql.SQLException: ORA-01776: cannot modify more than one base table through a join view "
    Can anyone help me, please ?
    null

    Hi,
    This is a classic join view problem, where u cannot update two tables in one shot. The main problem is that ur two tables are not normalized correctly. Why can't they be in just one table?
    OK, if that is not possible, then the best way out is to create a simple INSTEAD OF trigger on the view which will insert correclty,
    e.g.
    CREATE TRIGGER bookprice_tr INSTEAD OF INSERT ON Bookprice FOR EACH ROW
    BEGIN
    insert into Book values (:NEW.Book_id,
    :NEW.Book_name, :NEW.Ref_to_Price);
    insert into Price
    values(:NEW.Price_ID, :NEW.Price_DM);
    END;
    Hope this helps,
    Murali

  • Loading external XML data into XMLObject

    hey all,
    i've been working on a basic fl2 app that generates a list of
    posts from an external XML file located on my server
    (www.omedia.mobi/forum.xml) The swf file is also located there in
    the same directory .(crime.swf).
    The app runs fine in the emulator, both when i tried to load
    the data locally on my mac, and when i load it from the server. But
    when i put the swf file on my N70, it fails to load the data.
    I'm banging my head against a wall trying to get this sorted.
    has anyone had any similar experiences?
    any help would be apprieciated...
    many thanks
    Matt

    Matt–
    Dumb question, are you 100% sure that your phone is making
    any connection to the internet? Does your phone read a name/value
    variable from an external file?
    I just build a file to test this (It won't work
    online—it will only work on a phone.):
    http://punchkickinteractive.com/development/mobileConnectionTest/mobileConnection.swf
    The FLA is also up:
    http://punchkickinteractive.com/development/mobileConnectionTest/mobileConnection.fla
    Also, you can check out:
    http://www.adobe.com/devnet/devices/articles/flashlite11_rss.html
    quote:
    //Some of the code from the FLA:
    canLoad = _capLoadData;
    if (canLoad == 1) {
    urlPath = "
    http://punchkickinteractive.com/development/mobileConnectionTest/mobileConnection.txt";
    loadVariables(urlPath, _root);
    } else {
    connection = "client does not support loading dynamic data";
    // where "connection" is the variable name of the text field
    If the connection is present, then I think I know what is
    wrong. Let me know.

  • Error while inserting xml data into table

    Hello
    I am running thid stored procedure and this compiles correctly , but when I try to execute it gives me a error, I have been trying this form the past 3 days , could anyone please help me ASAP
    SQL> CREATE OR REPLACE PROCEDURE loadxml12 AS
    2 fil BFILE;
    3 buffer RAW(32767);
    4 len INTEGER;
    5 insrow INTEGER;
    6 BEGIN
    7 SELECT f_lob INTO fil FROM xml_temp12 WHERE key = 1;
    8 DBMS_LOB.FILEOPEN(fil,DBMS_LOB.FILE_READONLY);
    9 len := DBMS_LOB.GETLENGTH(fil);
    10 DBMS_LOB.READ(fil,len,1,buffer);
    11 xmlgen.resetOptions;
    12 insrow := xmlgen.insertXML('xml_doc',UTL_RAW.CAST_TO_VARCHAR2(buffer));
    13 DBMS_OUTPUT.PUT_LINE(insrow);
    14 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    15 DBMS_LOB.FILECLOSE(fil);
    16 END IF;
    17 EXCEPTION
    18 WHEN OTHERS THEN
    19 DBMS_OUTPUT.PUT_LINE('In Exception');
    20 DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
    21 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    22 DBMS_LOB.FILECLOSE(fil);
    23 END IF;
    24 end;
    25 /
    Procedure created.
    SQL> exec loadxml12
    In Exception
    BEGIN loadxml12; END;
    ERROR at line 1:
    ORA-20000: ORU-10028: line length overflow, limit of 255 bytes per line
    ORA-06512: at "SYS.DBMS_OUTPUT", line 99
    ORA-06512: at "SYS.DBMS_OUTPUT", line 65
    ORA-06512: at "CARCLUB_RW2.LOADXML12", line 20
    ORA-06512: at line 1
    null

    Could you explain what your procedure does, please. I also tried to compile it but always got error message:
    PL/SQL: SQL Statement ignored
    PLS-00385: type mismatch found at 'FIL' in SELECT...INTO
    statement
    SQL> CREATE OR REPLACE PROCEDURE loadxml12 AS
    2 fil BFILE;
    3 buffer RAW(32767);
    4 len INTEGER;
    5 insrow INTEGER;
    6 BEGIN
    7 SELECT f_lob INTO fil FROM xml_temp12 WHERE key = 1;
    8 DBMS_LOB.FILEOPEN(fil,DBMS_LOB.FILE_READONLY);
    9 len := DBMS_LOB.GETLENGTH(fil);
    10 DBMS_LOB.READ(fil,len,1,buffer);
    11 xmlgen.resetOptions;
    12 insrow := xmlgen.insertXML('xml_doc',UTL_RAW.CAST_TO_VARCHAR2(buffer));
    13 DBMS_OUTPUT.PUT_LINE(insrow);
    14 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    15 DBMS_LOB.FILECLOSE(fil);
    16 END IF;
    17 EXCEPTION
    18 WHEN OTHERS THEN
    19 DBMS_OUTPUT.PUT_LINE('In Exception');
    20 DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
    21 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    22 DBMS_LOB.FILECLOSE(fil);
    23 END IF;
    24 end;
    25 /
    Bober
    null

  • 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.

  • Load xml data into database

    Hi,
    I need to load the xml data into the relational tables. I was trying to use a DOM parser, but the thing is that i had to hard code the element node values to match the columns in the tables, and in later stage if there is change to the xml i have to change my program and recompile, i want a more flexible solution, where in i can parse the data and load into database without much changes. I do not know how to accomplish this. I have searched on this topic, but could not find a clear solution anywhere. Can anybody suggest a solution to this.
    Thanks & regards.

    For which database?
    With the Oracle database an XML document may be stored in a database with the XML SQL (XSU) utility.
    1. Create a table in the database with columns corresponding to the elements in the XML document.
    2. With the XSU store the XML document. The attributes in the XML document do not get stored.
    3. To store the attributes also, apply an XSLT to the XML document and convert the attributes to elements.

  • Error occured while inserting XML file data into table.

    Hello,
    I m trying to load xml data into table by following code.but getting below error
    Error at line 1
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00222: error received from SAX callback function
    ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
    ORA-06512: at line 21
    DECLARE
      xmldoc   clob;
      insCtx   DBMS_XMLStore.ctxType;
      dname    varchar2(20) := 'MDIR';
      rows  number;
    BEGIN
        xmldoc := dbms_xslprocessor.read2clob(dname, 'try_xm3.xml');
        insCtx := DBMS_XMLStore.newContext('try1');
    dbms_output.put_line('1');
        DBMS_XMLStore.setRowTag(insCtx, 'cajas');
    rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
    commit;
      dbms_output.put_line('INSERT DONE '||TO_CHAR(rows));
      DBMS_XMLStore.closeContext(insCtx);
    END;
    <?xml version="1.0" encoding="utf-8"?>
    <cajas xmlns="PBcion.Caja" fec="2011-03-02T14:20:14" codDeleg="093">
      <caj codPrev="80001223" fechaInicio="2011-03-02" fec="2011-09-02" couta="01" idPerio="1" caj="32"></caj>
    </cajas>can you please look into this?
    I m using oracle 10g

    SQL> create table try1
      2  (
      3  codPrev number,
      4  fechaInicio varchar2(25),
      5  fec varchar2(25),
      6  couta number,
      7  idPerio number,
      8  caj number
      9  );
    Table created
    SQL>
    SQL> insert into try1 (codprev, fechainicio, fec, couta, idperio, caj)
      2  select x.codprev, x.fechainicio, x.fec, x.couta, x.idperio, x.caj
      3  from xmltable(
      4         xmlnamespaces(default 'PBcion.Caja')
      5       , '/cajas/caj'
      6         passing xmltype(bfilename('TEST_DIR','try_xm3.xml'), nls_charset_id('AL32UTF8'))
      7         columns codPrev     number       path '@codPrev'
      8               , fechaInicio varchar2(25) path '@fechaInicio'
      9               , fec         varchar2(25) path '@fec'
    10               , couta       number       path '@couta'
    11               , idPerio     number       path '@idPerio'
    12               , caj         number       path '@caj'
    13       ) x
    14  ;
    1 row inserted
    SQL> select * from try1;
       CODPREV FECHAINICIO               FEC                            COUTA    IDPERIO        CAJ
      80001223 2011-03-02                2011-09-02                         1          1         32
    Since the two date attributes are coming in the W3C's xs:date format, you can directly define the corresponding columns as DATE and use a DATE projection in XMLTable :
    SQL> alter table try1 modify (fechainicio date);
    Table altered
    SQL> alter table try1 modify (fec date);
    Table altered
    SQL>
    SQL> insert into try1 (codprev, fechainicio, fec, couta, idperio, caj)
      2  select x.codprev, x.fechainicio, x.fec, x.couta, x.idperio, x.caj
      3  from xmltable(
      4         xmlnamespaces(default 'PBcion.Caja')
      5       , '/cajas/caj'
      6         passing xmltype(bfilename('TEST_DIR','try_xm3.xml'), nls_charset_id('AL32UTF8'))
      7         columns codPrev     number       path '@codPrev'
      8               , fechaInicio date         path '@fechaInicio'
      9               , fec         date         path '@fec'
    10               , couta       number       path '@couta'
    11               , idPerio     number       path '@idPerio'
    12               , caj         number       path '@caj'
    13       ) x
    14  ;
    1 row inserted
    SQL> select * from try1;
       CODPREV FECHAINICIO FEC              COUTA    IDPERIO        CAJ
      80001223 02/03/2011  02/09/2011           1          1         32

Maybe you are looking for

  • How to un-sync a calendar and NOT delete ANY events?  Please help!

    Hi, I seem to be the only one with this problem. I search all over and can't find information for what I want to do, everyone wants to do the opposite. So basically I had a job and an iphone. I used my calendar at work for personal events and so fort

  • Firefox add on forecaster is not change locations and is not showing up in add on bar yet is shows it its installed

    I'm using a desktop computer that I built using windows 7. I'm using the latest Firefox browser 5.0.1 and decided to customize it. I installed a persona and a pop up blocker with no problem. When I install forecaster it appears to install but the loc

  • WLS 11 Policy migration during EAR deployment

    We are installing an ADF 11g EAR into our development instance of WLS 10.3.1 and are seeing some strange behavior with the ADF policy migration. During the EAR install from either the WLS console, or using WLST scripts, the ear deployment appears to

  • Report Complexity

    I have a very complex report. It contains information from the same table with different parameters. It contains information from several different tables. And it includes a table of data from one table with a summary of totals at the foot of the tab

  • Java -jar oc4j.jar -properties

    hi, I run following this one. i got a error please rectify that java -jar oc4j.jar -properties *09/05/13 16:11:11 Invalid jsp taglib location: C:\Documents and Settings\nvinodh* *\Desktop\oc4j\j2ee\home\%s_javapOracleHome%\j2ee\home\jsp\lib\taglib do