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

Similar Messages

  • How can I load data into table with SQL*LOADER

    how can I load data into table with SQL*LOADER
    when column data length more than 255 bytes?
    when column exceed 255 ,data can not be insert into table by SQL*LOADER
    CREATE TABLE A (
    A VARCHAR2 ( 10 ) ,
    B VARCHAR2 ( 10 ) ,
    C VARCHAR2 ( 10 ) ,
    E VARCHAR2 ( 2000 ) );
    control file:
    load data
    append into table A
    fields terminated by X'09'
    (A , B , C , E )
    SQL*LOADER command:
    sqlldr test/test control=A_ctl.txt data=A.xls log=b.log
    datafile:
    column E is more than 255bytes
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)

    Check this out.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1006961

  • How to store xml data into file in xml format through java program?

    HI Friends,
    Please let me know
    How to store xml data into file in xml format through java program?
    thanks......
    can discuss further at messenger.....
    Avanish Kumar Singh
    Software Engineer,
    Samsung India Development Center,
    Bangalore--560001.
    [email protected]

    Hi i need to write the data from an XML file to a Microsoft SQL SErver database!
    i got a piece of code from the net which allows me to parse th file:
    import java.io.IOException;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    import org.apache.xerces.parsers.SAXParser;
    import java.lang.*;
    public class MySaxParser extends DefaultHandler
    private static int INDENT = 4;
    private static String attList = "";
    public static void main(String[] argv)
    if (argv.length != 1)
    System.out.println("Usage: java MySaxParser [URI]");
    System.exit(0);
    String uri = argv[0];
    try
    XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
    MySaxParser MySaxParserInstance = new MySaxParser();
    parser.setContentHandler(MySaxParserInstance);
    parser.parse(uri);
    catch(IOException ioe)
    ioe.printStackTrace();
    catch(SAXException saxe)
    saxe.printStackTrace();
    private int idx = 0;
    public void characters(char[] ch, int start, int length)
    throws SAXException
    String s = new String(ch, start, length);
    if (ch[0] == '\n')
    return;
    System.out.println(getIndent() + " Value: " + s);
    public void endDocument() throws SAXException
    idx -= INDENT;
    public void endElement(String uri, String localName, String qName) throws SAXException
    if (!attList.equals(""))
    System.out.println(getIndent() + " Attributes: " + attList);
    attList = "";
    System.out.println(getIndent() + "end document");
    idx -= INDENT;
    public void startDocument() throws SAXException
    idx += INDENT;
    public void startElement(String uri,
    String localName,
    String qName,
    Attributes attributes) throws SAXException
    idx += INDENT;
    System.out.println('\n' + getIndent() + "start element: " + localName);
    if (localName.compareTo("Machine") == 0)
    System.out.println("YES");
    if (attributes.getLength() > 0)
    idx += INDENT;
    for (int i = 0; i < attributes.getLength(); i++)
    attList = attList + attributes.getLocalName(i) + " = " + attributes.getValue(i);
    if (i < (attributes.getLength() - 1))
    attList = attList + ", ";
    idx-= INDENT;
    private String getIndent()
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < idx; i++)
    sb.append(" ");
    return sb.toString();
    }// END PRGM
    Now , am not a very good Java DEv. and i need to find a soln. to this prob within 1 week.
    The next step is to write the data to the DB.
    Am sending an example of my file:
    <Start>
    <Machine>
    <Hostname> IPCServer </Hostname>
    <HostID> 80c04499 </HostID>
    <MachineType> sun4u [ID 466748 kern.info] Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 360MHz) </MachineType>
    <CPU> UltraSPARC-IIi at 360 MHz </CPU>
    <Memory> RAM : 512 MB </Memory>
    <HostAdapter>
    <HA> kern.info] </HA>
    </HostAdapter>
    <Harddisks>
    <HD>
    <HD1> c0t0d0 ctrl kern.info] target 0 lun 0 </HD1>
    <HD2> ST38420A 8.2 GB </HD2>
    </HD>
    </Harddisks>
    <GraphicCard> m64B : PCI PGX 8-bit +Accel. </GraphicCard>
    <NetworkType> hme0 : Fast-Ethernet </NetworkType>
    <EthernetAddress> 09:00:30:C1:34:90 </EthernetAddress>
    <IPAddress> 149.51.23.140 </IPAddress>
    </Machine>
    </Start>
    Note that i can have more than 1 machines (meaning that i have to loop thru the file to be able to write to the DB)
    Cal u tellme what to do!
    Even better- do u have a piece of code that will help me understand and implement the database writing portion?
    I badly need help here.
    THANX

  • How to store XML data into Oracle Table

    I had trouble to store XML data into Oracle Table with XDK (Oracle 8.1.7 ). The error is:
    C:\XDK_Java_9_2\xdk\demo\java\Test>java testInsert Dept.xml
    <Line 1, Column 1>: XML-0108: (Fatal Error) Start of root element expected.
    Exception in thread "main" oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2263)
    at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1333)
    at testInsert.main(testInsert.java:8)
    Here is my xml file:
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <DEPTNO>10</DEPTNO>
    <DNAME>ACCOUNTING</DNAME>
    <LOC>NEW YORK</LOC>
    </ROW>
    <ROW num="2">
    <DEPTNO>20</DEPTNO>
    <DNAME>RESEARCH</DNAME>
    <LOC>DALLAS</LOC>
    </ROW>
    <ROW num="3">
    <DEPTNO>30</DEPTNO>
    <DNAME>SALES</DNAME>
    <LOC>CHICAGO</LOC>
    </ROW>
    <ROW num="4">
    <DEPTNO>40</DEPTNO>
    <DNAME>OPERATIONS</DNAME>
    <LOC>BOSTON</LOC>
    </ROW>
    </ROWSET>
    and here is structure of table:
    Name Null? Type
    DEPTNO NOT NULL NUMBER(2)
    DNAME VARCHAR2(14)
    LOC VARCHAR2(13)
    and here is my Java Code:
    import java.sql.*;
    import oracle.xml.sql.dml.OracleXMLSave;
    public class testInsert{
         public static void main(String[] args) throws SQLException{
              Connection conn = getConnection();
              OracleXMLSave sav = new OracleXMLSave(conn,"scott.tmp_dept");
              sav.insertXML(args[0]);
              sav.close();
              conn.close();
         private static Connection getConnection()throws SQLException{
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
              Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@amt-ebdev01:1521:mydept","scott","tiger");
              return conn;
    Could you help me ? Thanks !

    The problem is that you need to pass avalid URL , Document...
    Please try this code instead:
    import java.net.*;
    import java.sql.*;
    import java.io.*;
    import oracle.xml.sql.dml.OracleXMLSave;
    public class testInsert
    public static void main(String[] args) throws SQLException{
    Connection conn = getConnection();
    OracleXMLSave sav = new OracleXMLSave(conn,"scott.temp_dept");
    URL url = createURL(args[0]);
    sav.insertXML(url);
    sav.close();
    conn.close();
    private static Connection getConnection()throws SQLException{
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@dlsun1982:1521:jwxdk9i","scott","tiger");
    return conn;
    // Helper method to create a URL from a file name
    static URL createURL(String fileName)
    URL url = null;
    try
    url = new URL(fileName);
    catch (MalformedURLException ex)
    File f = new File(fileName);
    try
    String path = f.getAbsolutePath();
    // This is a bunch of weird code that is required to
    // make a valid URL on the Windows platform, due
    // to inconsistencies in what getAbsolutePath returns.
    String fs = System.getProperty("file.separator");
    if (fs.length() == 1)
    char sep = fs.charAt(0);
    if (sep != '/')
    path = path.replace(sep, '/');
    if (path.charAt(0) != '/')
    path = '/' + path;
    path = "file://" + path;
    url = new URL(path);
    catch (MalformedURLException e)
    System.out.println("Cannot create url for: " + fileName);
    System.exit(0);
    return url;

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

  • How to parse xml data into java component

    hi
    everybody.
    i am new with XML, and i am trying to parse xml data into a java application.
    can anybody guide me how to do it.
    the following is my file.
    //MyLogin.java
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    class MyLogin extends JFrame implements ActionListener
         JFrame loginframe;
         JLabel labelname;
         JLabel labelpassword;
         JTextField textname;
         JPasswordField textpassword;
         JButton okbutton;
         String name = "";
         FileOutputStream out;
         PrintStream p;
         Date date;
         GregorianCalendar gcal;
         GridBagLayout gl;
         GridBagConstraints gbc;
         public MyLogin()
              loginframe = new JFrame("Login");
              gl = new GridBagLayout();
              gbc = new GridBagConstraints();
              labelname = new JLabel("User");
              labelpassword = new JLabel("Password");
              textname = new JTextField("",9);
              textpassword = new JPasswordField(5);
              okbutton = new JButton("OK");
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 5;
              gl.setConstraints(labelname,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 2;
              gbc.gridy = 5;
              gl.setConstraints(textname,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 10;
              gl.setConstraints(labelpassword,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 2;
              gbc.gridy = 10;
              gl.setConstraints(textpassword,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 15;
              gl.setConstraints(okbutton,gbc);
              Container contentpane = getContentPane();
              loginframe.setContentPane(contentpane);
              contentpane.setLayout(gl);
              contentpane.add(labelname);
              contentpane.add(labelpassword);
              contentpane.add(textname);
              contentpane.add(textpassword);
              contentpane.add(okbutton);
              okbutton.addActionListener(this);
              loginframe.setSize(300,300);
              loginframe.setVisible(true);
         public static void main(String a[])
              new MyLogin();
         public void reset()
              textname.setText("");
              textpassword.setText("");
         public void run()
              try
                   String text = textname.getText();
                   String blank="";
                   if(text.equals(blank))
                      System.out.println("First Enter a UserName");
                   else
                        if(text != blank)
                             date = new Date();
                             gcal = new GregorianCalendar();
                             gcal.setTime(date);
                             out = new FileOutputStream("log.txt",true);
                             p = new PrintStream( out );
                             name = textname.getText();
                             String entry = "UserName:- " + name + " Logged in:- " + gcal.get(Calendar.HOUR) + ":" + gcal.get(Calendar.MINUTE) + " Date:- " + gcal.get(Calendar.DATE) + "/" + gcal.get(Calendar.MONTH) + "/" + gcal.get(Calendar.YEAR);
                             p.println(entry);
                             System.out.println("Record Saved");
                             reset();
                             p.close();
              catch (IOException e)
                   System.err.println("Error writing to file");
         public void actionPerformed(ActionEvent ae)
              String str = ae.getActionCommand();
              if(str.equals("OK"))
                   run();
                   //loginframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }

    hi, thanks for ur reply.
    i visited that url, i was able to know much about xml.
    so now my requirement is DOM.
    but i dont know how to code in my existing file.
    means i want to know what to link all my textfield to xml file.
    can u please help me out. i am confused.
    waiting for ur reply

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

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

  • How to load xml data into a database table....

    Hi All,
    Iam new to this forum.I have an xmldoc table of xmltype(datatype).Iam able to insert xml data to it.I have another table called new_books.sql:
    CREATE TABLE NEW_BOOKS
    TITLE          VARCHAR2(255) NOT NULL,
    LINK          VARCHAR2(80) NULL,
    PUBLISHER     VARCHAR2(255) NULL,
    SUBJECT     VARCHAR2(80) NULL,
    PUBDATE     VARCHAR2(40) NULL,
    DESCRIPTION     VARCHAR2(4000) NULL,
    AUTHOR     VARCHAR2(80) NULL,
    PRIMARY      KEY(TITLE)
    Now i want to copy the data in the xmldoc table into the table new_books.sql.Is there any procedure to do that in PL/SQL?
    Given below is the xmlfile:
    - <rdf>
    - <item>
    <title>Enterprise SOA: Designing IT for Business Innovation</title>
    <link>http://safari.oreilly.com/0596102380?a=102682</link>
    <publisher>O'Reilly</publisher>
    <creator>Thomas Mattern</creator>
    <creator>Dan Woods</creator>
    <subject>IT Infrastructure</subject>
    <date>April 2006</date>
    </item>
    </rdf>
    Thanks in Advance,
    Gita.

    Assuming the table xmldoc(of xmltype) has this XML
    SQL> select * from xmldoc;
    SYS_NC_ROWINFO$
    <rdf>
    <item>
    <title>Enterprise SOA: Designing IT for Business Innovation</title>
    <link>http://safari.oreilly.com/0596102380?a=102682</link>
    <publisher>O'Reilly</publisher>
    <creator>Thomas Mattern</creator>
    <creator>Dan Woods</creator>
    <subject>IT Infrastructure</subject>
    <date>April 2006</date>
    </item>
    </rdf>
    SQL> INSERT INTO NEW_BOOKS(TITLE, LINK, PUBLISHER, SUBJECT)
      2  select extractvalue(value(x),'/rdf/item/title') as title,
      3  extractvalue(value(x),'/rdf/item/link') as link,
      4  extractvalue(value(x),'/rdf/item/publisher') as publisher,
      5  extractvalue(value(x),'/rdf/item/subject') as subject
      6  from xmldoc x
      7  ;
    1 row created.

  • 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

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • Helped, how to load xml data into database

    Hi,
    Given a DTD, can the XML SQL Utility generate
    the database schema?
    I currently have the dtd file to define
    the data type and xml data and I am looking
    for ways of how the XML/DTD can be loaded
    into the oracle db.
    Any suggestions/recommendations are
    appreciated.
    Thanks,
    Judy
    null

    You could check out this web site:
    http://www.rpbourret.com/xml/XMLAndDatabases.htm#software
    where you can find a list of products that can translate a DTD to a relational schema. Also, there are several technical papers that discuss algorithms to carry out this translation. FYI, We have implemented a similar system,and testing it out.
    null

  • How to load blob data into table

    hi
    i have a table with
    ID     NUMBER     No     -      1
    PARENT_ID     NUMBER     No     -      -
    DOCUMENT     BLOB     Yes     -      -
    NAME     VARCHAR2(40)     Yes     -      -
    MIMETYPE     VARCHAR2(40)     Yes     -      -
    COMMENTS     VARCHAR2(400)     Yes     -      -
    TIMESTAMP_CREATED     TIMESTAMP(6)     Yes     -      -
    CREATED_BY     VARCHAR2(40)     Yes     -      -
    TIMESTAMP_MODIFIED     TIMESTAMP(6)     Yes     -      -
    MODIFIED_BY     CHAR(40)     Yes     -      -
    IS_GROUP     CHAR(1)     No     -      -
    FILE_NAME     VARCHAR2(4000)     Yes     -      -
    as columns. i want to insert blob data into the empty table.i have some fields in the form through which i insert data by hard coding in a process.when i upload a document in the filebrowse type field the mime type is not updating though i have written code in the source value. i removed the database links of the form with the table and that is why i am hard coding to the table thru a process. could u suggest a query where i can insert the blolb data.
    i use the process
    begin
    select max(ID) into aaa from "PSA_KNOWLEDGE_TREE";
    insert into PSA_KNOWLEDGE_TREE values(aaa+1,1,null,:p126_NEW_GROUP,null,:p126_COMMENTS,:P126_TIMESTAMP_CREATED,:P126_CREATED_BY,null,null,'Y',null);

    could u please type the query according to my table and process requirements. i have tried many queries and i have failed to load the blob data. the imetype is not being updated.
    thnx for ur reply

  • How to transfer XML-Data into a WebDynPro-Application?

    An external partner has a calling interface that sends a HTTP-Redirect to a specific application-url and transfers all the data in one POST-Parameter.
    The value of this POST-Paramater (CALLINTERFACE) consists the XML-Data.
    <form id='InterfaceData3' method='post' action='/ProduktFrontController/Start'>
    <textarea cols="80" rows="30" name='CALLINTERFACE'><?xml version="1.0" encoding="UTF-8"?>
      <authentifizierung version="1.0">
           XML-Data.....
      </authentifizierung>
    <br>
    <p><input id='button1' type='submit' name='Button' value='Absenden'></p>
    </form>
    Standard-Java:
    In our Java-Application we can read the POST-Value (XML-Data) via the HTTPServletRequest-Object/Instance.
    WebDynPro-Java:
    IWDProtocolAdapter protocolAdapter = WDProtocolAdapter.getProtocolAdapter();
    IWDRequest request = protocolAdapter.getRequestObject();
    String xmlData = request.getParameter("CALLINTERFACE");
    In WebDynPro for ABAP I couldnt find a equivalent solution /technic to read the POST-Parameter-Value.
    So I have to write a lot of annoying 'glue-code':-(      (HTTP-Request-Handler for reading, Shared Memory / Objects for transfer to WebDynPro ABAP),
    (Remark: It's no solution to transfer XML-Data via a URL-Parameter because it is too big (> 1 KByte) and the external partner doesn't support this option!).
    My questions:
    1) What technics for transfering Data (not only 2 or 3 Parameter) form external web-applications into WebDynPro ABAP applications does SAP support?
    2) Is it possible to reach the calling HTTP-Request from WebDynPro-ABAP? (MayBe via ABAP-Callback-Functions)
    Sincerely
    Steffen

    Hi,
    thank you for your answers:-)
    In conclusion the result is:
    1) There is no "direct" way to read POST-Parameter in WebDynPro ABAP
    => You have to write a wrapper in BSP or an ICF -  HTTP_REQUEST_HANDLER
      (A  ABAP-Class that implements the Interface "IF_HTTP_EXTENSION"
         that reads the POST-Parameter-Value and transfers the value into a reachable localtion for WebDynPro-Abap.
    2) For parsing the XML-Data I can use for example STRANS tcode or  Simple Transformations
    3) For transfering the Data between the BSP / the Request-Handler and WebDynPro for ABAP, I can use for example SharedMemory, Shared Objects.
    Regards
    Steffen
    Edited by: Steffen Spahr on Jul 19, 2011 8:35 AM
    Edited by: Steffen Spahr on Jul 19, 2011 8:55 AM

Maybe you are looking for

  • Where can I find OS 10.4.11 to install to my old PowerBook G4?

    Hello. I have an old Powerbook G4 on which I had installed OS 10.4.11, but I can't seem to find the cd to reinstall. It is running a bit slow as it has been many years, and I wanted to format the hard drive and reinstall the same OS. I also have Mac

  • HT1296 Trying to backup or sync calendar on iPhone to computer so I can have a copy

    The only option for syncing my calendar is to outlook; does not give me the option to sync anywhere else.  No data appears in outlook calendar, though, after syncing and after backup to computer.  How do I transfer calendar to computer so that I can

  • Changing Password Complexity in Solaris 10 6-06

    I'm trying to change the password complexity so that my passwords don't require a numeric or special character in the first six characters of a password, the smc console when adding users seems to ignore any change I make in /etc/default/passwd even

  • SSIS 2012 Project Deploymeny Progressively Slower

    I've noticed a gradual increase in the amount of time it takes for me to deploy a project to the SSIS Catalog. First of all, is there a way to deploy only specific packages or do I need to deploy the project everytime a package is added or changed? I

  • Triggers workflow from badi

    In crm 2007 two installed bases are there. one is customer ibase  and the other is company ibase   when the customer wants to transfer the component from company ibase to customer ibase(he simply drags  the component from company ibase to his ibase)