How to parse XML and store the data in  tables using sql or plsql?

I want to parse the xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xmlListWrapper>
    <size>2</size>
<AppTypeID>10</AppTypeID>
</xmlListWrapper>
and store in a table
|pk|apptypeid|
1     10

You can extract data from your XML along these lines...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select xmltype('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2  <xmlListWrapper>
  3    <size>2</size>
  4    <AppTypeID>10</AppTypeID>
  5    <AppTypeID>20</AppTypeID>
  6  </xmlListWrapper>') as xml from dual)
  7  --
  8  -- end of example data
  9  --
10  select x.*
11  from   t
12        ,xmltable('/xmlListWrapper/AppTypeID'
13                  passing t.xml
14                  columns pk for ordinality
15                         ,apptypeid number path '.'
16*                ) x
SQL> /
        PK  APPTYPEID
         1         10
         2         20
SQL>
Inserting it to a table is obviously achieved using an INSERT ... SELECT ... where the SELECT is extracting the data from the XML.

Similar Messages

  • How many days we can store the data  in psa & ods ?

    hi guru's
    how many days we can store the data  in psa & ods ?
    Thanks & Regards.
    Prabhakarreddy

    Hi Prabhakarreddy,
    As many days as you like:
    In the PSA you can keep data as long as you like but you will need more and more disk-space. So its advisable to clean up from time to time.
    Example:
    PSA's from full loads Clean up in a weeks time,
    PSA's from Deltas: Clean up after you are sure data is correct. (e.g. a month or 90 days)
    Remember that you cannot do a reconstruction from dataloads of which you have deleted the PSA. If some thing is wrong you will have to do an Init again!
    In ODS's you must keep data in order to keep your delta loads to cubes in order. Removing data will force you to do a new initial load.
    Sometime companies delete old data form ODS's that is older than a certain period (e.g. more than 3 years old) by running a selective deletion. You will have to do an init again. But loads and activation may run faster and of course you gain on disk space.
    Udo

  • How many years we can store the data in ODS as well as psa data ?

    Hi guru's
    how many years we can store the data in ODS? can u give particular years ?
    how many days we can store the data in psa ? could u tell me step by step procedure ?
    Thanks
    Reddy prabha

    Hi Prabhakarreddy,
    As many days as you like:
    In the PSA you can keep data as long as you like but you will need more and more disk-space. So its advisable to clean up from time to time.
    Example:
    PSA's from full loads Clean up in a weeks time,
    PSA's from Deltas: Clean up after you are sure data is correct. (e.g. a month or 90 days)
    Remember that you cannot do a reconstruction from dataloads of which you have deleted the PSA. If some thing is wrong you will have to do an Init again!
    In ODS's you must keep data in order to keep your delta loads to cubes in order. Removing data will force you to do a new initial load.
    Sometime companies delete old data form ODS's that is older than a certain period (e.g. more than 3 years old) by running a selective deletion. You will have to do an init again. But loads and activation may run faster and of course you gain on disk space.
    Udo

  • How can i open a DOC or TXT file and insert the data into table?

    How can i open a DOC or TXT file and insert the data into table?
    I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
    I'd like open DOC file and I'd like insert them into the table with same columns.
    Thanks.

    Use the SQL*Loader utility or the UTL_FILE package.

  • How can I resize and reposition the Date Created window for All windows?

    When setting view options for a finder window set to list view, I cannot get column resizing or positioning to hold. When making those changes, the option for "All Windows" automatically shifts to "This window only" and it then does not hold.
    How can I resize and reposition the Date Created column for All WIndows?

    Hi Harmz,
    Try dragging this file to the Îesktop & reboot...
    /Users/YourUserName/Library/Preferences/com.apple.finder.plist

  • How to trace the data dictionary tables used in the standard transaction

    Dear all,
    Help me to trace the data dictionary tables used in the standard transaction "crm_dno_monitor". I need to find the tables where the data are stored.
    or
    Tell me generally how to find the tables used in the standard transaction.
    Regards,
    Prem

    Hi,
    Open the program of that standard transaction in object navigator or SE80..
    Then click on the dictionary structures tab..
    U can find the database tables used in this transaction..
    \[removed by moderator\]
    Regards,
    Rakesh
    Edited by: Jan Stallkamp on Jul 29, 2008 5:29 PM

  • How to fetch data from XML and store it in internal table

    Hi All,
    Can anyone help me out, in fetching data from xml and store it in an internal table. Is there any standard function module is there?
    Regards,
    Karthick

    to do this you can either develop a XSLT program and use it with CALL TRNSFORMATION key word to tranform the XML into itab .
    (search the ABAP General forum, i have posted few samples)
    or simply use the following FM which converts your XML into a itab of name value pair (name would holw the element name and value would hold the value of the element) which you can then loop and read it to your itb.
    data:             xmldata type xstring .
    data: result_xml type standard table of smum_xmltb .
    data: return type standard table of bapiret2 .
    CALL FUNCTION 'SMUM_XML_PARSE'
      EXPORTING
        xml_input       = xmldata
      TABLES
        xml_table       = result_xml
        return          = return .
    Regards
    Raja

  • (Urgent help needed) how to read txt file and store the data into 2D-array?

    Hi, I have a GUI which allow to choose file from the file chooser, and when "Read file" button is pressed, I want to show the array data into the textarea.
    The sample data is like this followed:
    -0.0007     -0.0061     0.0006
    -0.0002     0.0203     0.0066
    0     0.2317     0.008
    0.0017     0.5957     0.0008
    0.0024     1.071     0.0029
    0.0439     1.4873     -0.0003
    I want my program to scan through and store these data into 2D array.
    However for some reason, my source code issues errors, and I don't know what's wrong with it, seems to have a problem in StringTokenizer though. Can anybody help me?
    Thanks in advance.
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.StringTokenizer;
    public class FileReduction1 extends JFrame implements ActionListener{
    // GUI features
    private BufferedReader fileInput;
    private JTextArea textArea;
    private JButton openButton, readButton,processButton,saveButton;
    private JTextField textfield;
    private JPanel pnlfile;
    private JPanel buttonpnl;
    private JPanel buttonbar;
    // Other fields
    private File fileName;
    private String[][] data;
    private int numLines;
    public FileReduction1(String s) {
    super(s);
    // Content pane
         Container cp = getContentPane();
         cp.setLayout(new BorderLayout());     
    // Open button Panel
    pnlfile=new JPanel(new BorderLayout());
         textfield=new JTextField();
         openButton = new JButton("Open File");
    openButton.addActionListener(this);
    pnlfile.add(openButton,BorderLayout.WEST);
         pnlfile.add(textfield,BorderLayout.CENTER);
         readButton = new JButton("Read File");
    readButton.addActionListener(this);
         readButton.setEnabled(false);
    pnlfile.add(readButton,BorderLayout.EAST);
         cp.add(pnlfile, BorderLayout.NORTH);
         // Text area     
         textArea = new JTextArea(10, 100);
    cp.add(new JScrollPane(textArea),BorderLayout.CENTER);
    processButton = new JButton("Process");
    //processButton.addActionListener(this);
    saveButton=new JButton("Save into");
    //saveButton.addActionListener(this);
    buttonbar=new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonpnl=new JPanel(new GridLayout(1,0));
    buttonpnl.add(processButton);
    buttonpnl.add(saveButton);
    buttonbar.add(buttonpnl);
    cp.add(buttonbar,BorderLayout.SOUTH);
    /* ACTION PERFORMED */
    public void actionPerformed(ActionEvent event) {
    if (event.getActionCommand().equals("Open File")) getFileName();
         if (event.getActionCommand().equals("Read File")) readFile();
    /* OPEN THE FILE */
    private void getFileName() {
    // Display file dialog so user can select file to open
         JFileChooser fileChooser = new JFileChooser();
         fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
         int result = fileChooser.showOpenDialog(this);
         // If cancel button selected return
         if (result == JFileChooser.CANCEL_OPTION) return;
    if (result == JFileChooser.APPROVE_OPTION)
         fileName = fileChooser.getSelectedFile();
    textfield.setText(fileName.getName());
         if (checkFileName()) {
         openButton.setEnabled(false);
         readButton.setEnabled(true);
         // Obtain selected file
    /* READ FILE */
    private void readFile() {
    // Disable read button
    readButton.setEnabled(false);
    // Dimension data structure
         getNumberOfLines();
         data = new String[numLines][];
         // Read file
         readTheFile();
         // Output to text area     
         textArea.setText(data[0][0] + "\n");
         for(int index=0;index < data.length;index++)
    for(int j=1;j<data[index].length;j++)
    textArea.append(data[index][j] + "\n");
         // Rnable open button
         openButton.setEnabled(true);
    /* GET NUMBER OF LINES */
    /* Get number of lines in file and prepare data structure. */
    private void getNumberOfLines() {
    int counter = 0;
         // Open the file
         openFile();
         // Loop through file incrementing counter
         try {
         String line = fileInput.readLine();
         while (line != null) {
         counter++;
              System.out.println("(" + counter + ") " + line);
    line = fileInput.readLine();
         numLines = counter;
    closeFile();
         catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error reading File",
                   "Error 5: ",JOptionPane.ERROR_MESSAGE);
         closeFile();
         System.exit(1);
    /* READ FILE */
    private void readTheFile() {
    // Open the file
    int row=0;
    int col=0;
         openFile();
    System.out.println("Read the file");     
         // Loop through file incrementing counter
         try {
    String line = fileInput.readLine();
         while (line != null)
    StringTokenizer st=new StringTokenizer(line);
    while(st.hasMoreTokens())
    data[row][col]=st.nextToken();
    System.out.println(data[row][col]);
    col++;
    row++;
    closeFile();
    catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error reading File",
                   "Error 5: ",JOptionPane.ERROR_MESSAGE);
         closeFile();
         System.exit(1);
    /* CHECK FILE NAME */
    /* Return flase if selected file is a directory, access is denied or is
    not a file name. */
    private boolean checkFileName() {
         if (fileName.exists()) {
         if (fileName.canRead()) {
              if (fileName.isFile()) return(true);
              else JOptionPane.showMessageDialog(null,
                        "ERROR 3: File is a directory");
         else JOptionPane.showMessageDialog(null,
                        "ERROR 2: Access denied");
         else JOptionPane.showMessageDialog(null,
                        "ERROR 1: No such file!");
         // Return
         return(false);
    /* FILE HANDLING UTILITIES */
    /* OPEN FILE */
    private void openFile() {
         try {
         // Open file
         FileReader file = new FileReader(fileName);
         fileInput = new BufferedReader(file);
         catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error Opening File",
                   "Error 4: ",JOptionPane.ERROR_MESSAGE);
    System.out.println("File opened");
    /* CLOSE FILE */
    private void closeFile() {
    if (fileInput != null) {
         try {
              fileInput.close();
         catch (IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error Opening File",
                   "Error 4: ",JOptionPane.ERROR_MESSAGE);
    System.out.println("File closed");
    /* MAIN METHOD */
    /* MAIN METHOD */
    public static void main(String[] args) throws IOException {
         // Create instance of class FileChooser
         FileReduction1 newFile = new FileReduction1("File Reduction Program");
         // Make window vissible
         newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         newFile.setSize(500,400);
    newFile.setVisible(true);
    Java.lang.NullpointException
    at FileReductoin1.readTheFile <FileReduction1.java :172>
    at FileReductoin1.readFile <FileReduction1.java :110>
    at FileReductoin1.actionPerformed <FileReduction1.java :71>
    .

    1) Next time use the CODE tags. this is way too much unreadable crap.
    2) The problem is your String[][] data.... the only place I see you do anything approching initializing it is
    data = new String[numLines][];I think you want to do this..
    data = new String[numLines][3];anyway that's why it's blowing up on the line
    data[row][col]=st.nextToken();

  • How to parse xml and import to execel

    pls let me know how to parse XML file and import all data to execel sheet.

    Hi Mandya,
    This is outside of the normal use case for TestStand. It would be best to use a code module (developed in LabVIEW, C, or any other language) to accomlish this and then call it from a step in TestStand. You can find examples on ActiveX here:
    http://forums.ni.com/t5/NI-TestStand/Controlling-Excel-from-TestStand-with-Activex-Automation/td-p/1...
    I hope this helps.
    Frank L.
    Software Product Manager
    National Instruments

  • How to insert row in table control and save the data in tables

    Hi,
    I have one table control i am displaying data into table control ,
    my problem is : i want to display data into read mode in table control.
    but when i click on insert button on the same screen i want one blank line should inserted into table control , then i want to insert some data into table control on that row , when i click the save button . the new data inserted into the table control is insert that data into ztable ,
    please give me solution
    main problen is  how can know inserted line in table control and pass that data into ztable.

    Hi,
    Follow the below logic,
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0001.
      MODULE POPULATE_TABLE_CONTROL. --> Get the data from table store in 
                                                                          ITAB
      LOOP AT GT_CTRL_LP_D516 INTO GS_WA_CTRL_LP_D516
           WITH CONTROL CTRL_LP_D516
           CURSOR CTRL_LP_D516-CURRENT_LINE.
      The following module moves data to control
        MODULE MOVE_TO_CONTROL.--> Move data from ITAB to table control
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT GT_CTRL_LP_D516.
      ENDLOOP.
      MODULE EXIT AT EXIT-COMMAND.
      MODULE USER_COMMAND_0001.  --> Here you have to take out the values from table control and update database table
    Reward points if helpful.
    Thanks and regards,
    Mallareddy Rayapureddy,
    Munich, Germany.

  • How to execute unix command through odi and store the result in table

    I have to reconcile  if data is loaded in table from csv file or not . I have to create a oracle data integrator package/interface/procedure to execute unix command to count number of rows in the csv files and store the count result in a table then i have to query the loaded table and count number of rows there and store in the table and have to compare is counts are same or not,  Please assist me how to make package/interface/procedure to  execute unix command and store result in oracle table.
    Thanks in Advance

    Use ODI OS command tool in the ODI package.
    create an interface in ODI using LKM File to Sql and the output file generated with the csv file's row count as a source and the db table(where the count needs to be stored) as a target

  • How to continuous​ly do AOAI and buffer the data for later use?

    Is there a way to do simultaneous AI and AO and keep the data in the buffer until I am finished with reading, then read the buffer and save the data to disc. I want to acquire 1000 scans on up to 10 chanels at 10 000 Scans/s, while generating one output signal.
    I have seen plenty of continuous AIAO examples, but all they do is show the data. I don't mind not viewing the data, all I want is to hold it for later analysis, while avoiding writing to disc as I fear this will slow the process too much. Or would a different approach than simultaneous AIAO be more appropriate?
    I am using LabView 6.1 with 6024E DAQ card on a P-IV 1.5GHz.

    Use this vi MainProg.vi in the llb
    i use a same engine to acquire at 2 MS/s and generate at 3 MS/s
    "Fil" a ?crit dans le message de news:
    506500000008000000C8620000-1031838699000@exchange.​ni.com...
    > Is there a way to do simultaneous AI and AO and keep the data in the
    > buffer until I am finished with reading, then read the buffer and save
    > the data to disc. I want to acquire 1000 scans on up to 10 chanels at
    > 10 000 Scans/s, while generating one output signal.
    > I have seen plenty of continuous AIAO examples, but all they do is
    > show the data. I don't mind not viewing the data, all I want is to
    > hold it for later analysis, while avoiding writing to disc as I fear
    > this will slow the process too much. Or would a different appro
    ach
    > than simultaneous AIAO be more appropriate?
    > I am using LabView 6.1 with 6024E DAQ card on a P-IV 1.5GHz.
    [Attachment 4x10KSps to Disk& generate AO.llb, see below]
    Attachments:
    4x10KSps_to_Disk&_generate_AO.llb ‏128 KB

  • If my phone is stolen/lost how can i try to turn the data on by using the computer

    My phone got stolen last week and I want to see if I can track it. but I didn't have the " find my Iphone " app downloaded and my data was turned off. How can I download the app and turn my data on by using the I cloud  website?

    You don't need an app to track an iPhone from a computer. You can just open a web browser and go to https://www.icloud.com/#find
    But as it seems you are aware, the phone will need to be turned on and online. Following is a link to what is meant by online: iCloud: online
    More information: iCloud: Find My iPhone overview

  • My Vista system crashed due to a corrupted windows file. When I reformatted C:/ & reloaded firefox & tbird, my bookmarks were gone. I have an image of the drive , but I don't know how to recover them and get the data back where I can access it.

    Vista system crashed due to a corrupted system file. The C drive was reformatted, and windows reloaded, along with the rest of my programs.
    Before the drive was reformatted, an image was made of it on a USB drive to save all the data. Now I need to know how to get the Bookmarks back for Firefox, and the Address Book back for Thunderbird.
    Thanks

    Thanks for the quick response. It worked very well, for both Firefox and Tbird.
    One hitch, until I remembered: those are all hidden files, in hidden folders. I had a devil of a time finding the "roaming" folder, until I found out how to unhide everything. In years past, I used DOS for that kind of thing. Explorer is much less user-friendly. Now that I know how to do it, it's simple.
    Thanks again for the guidance

  • I can not boot my MacBook Pro. How do I get and save the data that is not backed up??

    I can not boot my MacBook Pro running on Lion 10.7.4. I pressed control, comment P and R keys and O got to the disk utility, then I tried to repair disk and it can not be repaired. I get a message that tells me to back up as much data as possible ?. But if I can not open the computer how can I save my data??
    I have a back up until 2 weeks ago on time machine. but the work of the last 2 weeks is extremely important how can I get it??
    If I use m time machine backup do I loose the additional data of the last two weeks!,
    Please help.. It's a huge amount of work that I have done and can not loose it

    If it were me, I'd get a new hard drive or SSD and put it in an external enclosure. Boot into the recovery partition, format the new drive (not the old one) and install the OS to it. Shut down the Mac, open it up, and swap the drives. You may be able to read your data from the old one externally if you're lucky. If you're very lucky you may be able to use Migration Assistant to move all your stuff to the new drive.
    Look at ifixit.com for the exact procedure to get to the drive on your model. If it's a unibody it's pretty simple.
    http://www.amazon.com/Sabrent-2-5-Inch-Aluminum-Enclosure-EC-TB4P/dp/B005EIGUD4/ ref=sr_1_3?ie=UTF8&qid=1392154588&sr=8-3&keywords=2.5+enclosure

Maybe you are looking for