How to transfer data between different tables in an Oracle 10g databse?

I have to do the following: there are 5 database tables in our Oracle 10g database that store certain data. Then there are 2 new tables where we want the data to go to. My task is to somehow transfer all the data that is in the first 5 tables and insert it in the 2 new ones. All tables are in the same database. The challenge lies in the fact that the structures of the tables are very dissimilar so it won't be a matter of a simple INSERT SQL query.
The data access tier of our application is developed in JAVA. We use EJB. So one way I am thinking of doing the above mentioned data transfer is to simply code it in the JAVA backed. But that might be to slow, there are millions of records in those first 5 tables. What is the best way to do something like that? Perhaps a custom (Perl?) script or some such?
Thanks.

The problem is that the way the data is stored in the old tables you cannot write a query that would return it in such a format that you could immediately insert it in the new table without some formatting. Let me illustrate with an example. To pull the data from the old tables I use this query:
SELECT
     SXML_DOCUMENT_DATA.VALUE As DocumentValue,
SXML_ELEMENT.NAME As ElementName
FROM
     SXML_DOCUMENT,
     SXML_DOCUMENT_DATA,
     SXML_DOCUMENT_DETAIL,
     SXML_ELEMENT,
     SXML_TYPE
WHERE
     SXML_TYPE.XML_TYPE_KEY = SXML_DOCUMENT.XML_TYPE_KEY
AND     SXML_DOCUMENT.XML_DOCUMENT_KEY = SXML_DOCUMENT_DETAIL.XML_DOCUMENT_KEY
AND     SXML_DOCUMENT_DETAIL.XML_DOCUMENT_DETAIL_KEY = SXML_DOCUMENT_DATA.XML_DOCUMENT_DETAIL_KEY
AND     SXML_ELEMENT.XML_ELEMENT_KEY = SXML_DOCUMENT_DATA.XML_ELEMENT_KEY
AND     SXML_TYPE.NAME = 'DA_UNIT_COMMITMENT'
AND     (SXML_ELEMENT.NAME = 'resource'
     OR SXML_ELEMENT.NAME = 'resourceType'
     OR SXML_ELEMENT.NAME = 'commitmentType'
     OR SXML_ELEMENT.NAME = 'startTime'
     OR SXML_ELEMENT.NAME = 'endTime'
     OR SXML_ELEMENT.NAME = 'schedulingCoordinator')
ORDER BY
     SXML_DOCUMENT.NAME,
     SXML_DOCUMENT_DETAIL.XML_DOCUMENT_DETAIL_KEY,
     SXML_DOCUMENT_DATA.XML_DOCUMENT_DATA_KEY,
     SXML_ELEMENT.NAME;
The results from the SQL query above look like this:
DOCUMENTVALUE | ELEMENTNAME
1 | ALAMIT_7_UNIT_1 | resource
2 | GEN | resourceType
3 | BRS8 | schedulingCoordinator
4 | IFM | commitmentType
5 | 2008-07-29T18:00:00:00 | startTime
6 | 2008-07-30T00:00:00 | endTime
7 | ALAMIT_7_UNIT_1 | resource
8 | GEN | resourceType
9 | BRS8 | schedulingCoordinator
10 | IFM | commitmentType
11 | 2008-07-29T00:00:00 | startTime
12 | 2008-07-29T04:00:00 | endTime
and so on. The type of data repeats every 6 records. And the values of each 6 records corresponds to 1 row in the new table, which looks like this:
schedulingCoordinator | resource | resourceType | commitmentType | startDate | endDate
1| 1 | 27 | GEN | IFM | 2008-07-29T18:00:00:00 | 2008-07-30T00:00:00
2| 1 | 27 | GEN | | 2008-07-29T00:00:00 | 2008-07-29T04:00:00
So hopefully now you see the challenge. It is not as simple as writing a SQL query that returns result rows corresponding 1 to 1 to a row in the new table. Somehow I need to take the first 6 result rows from that big SQL query and put them in the first row of the new table. Then the next 6 and put them in the second row and so on. And also, we are talking about millions of records. What happens if I process the first 2 million and then some error occurs? Do I start from the beginning again? One idea I have is to process the data in chunks, say process 500 results, commit, process another 500, commit, and so on.
Edited by: 799984 on Oct 11, 2010 9:08 AM

Similar Messages

  • How to transfer data between two tables

    Hi friends i have got a new problem actually i'm a fresher in this SAP so i have a doubt in SAP Smart Forms the problem is like this
    I have a data element common in both of the tables BSEG and KNA1 and the common data element is KUNNR so i want to transfer all the data in the table BSEG to KNA1 of the same data element(KUNNR) in which there is data regarding customer information so i want to transfer the single customer data into another table KNA1 and i want to display the data in the output plz any one can help me.

    hi.
    the below metjhod u can adopt.
    1)
    select data from 1st zable to internal table.
    2)insert data from internal table to 2nd ztable simple.
    data:begin of itab occurs 0.
    include structure ztable_structure1.
    data:end of itab.
    select * from ztable into table itab.
    modify ztable1 FROM TABLE itab.
    3 ) ike that u can catch date from other table.
    4) if any condition is there u can check it in the internal table.
    Rgds
    Anver
    if hlped pls mark points

  • How to transfer data between different nodes of the same context.

    Hi experts,
       I am working on an application in ABAP webdynpro in which i want to copy data from one node to another node in the same context of a view and both the nodes are mapped with different nodes of context of component controller. How to code this. Please help.
    Thanks and Regards.
    Vaibhav Tiwari.

    Hi Vaibhav,
    you are in the wrong forum.
    BTW: Copying value of nodes is done automaticcally if you connect the nodes.
    Regards Mario

  • Performace tuning: how to pass data between different batch job programs?

    Hi everyone,
        now i have one problem about performance tuning using threading in SAP programs: split one big program into two programs - one is main program and the other is sub program. using batch jobs, we can submit multi jobs of sub program at the same time.
        does anybody know how to pass data between different batch jobs? I don't want to use temp files. can ABAP memory can implement this?
        thanks!

    Wei,
    Yes we can transfer the data by using
    SAP Memory OR ABAP Memory.
    Ex:  V_count TYPE i.
      V_count = 100.
    LOOP AT  itab.
    IF v_count EQ 25.
    Here For every batch job
      EXPORT data TO MEMORY ID 'ABC'
       Function module
        JOB_OPEN
       JOB_SUBMIT
       JOB_CLOSE.
      ENDIF.
    ENDLOOP .
    IN your 2nd program.
    INITIALIZATION.
    IMPORT data FROM MEMORY IF 'ABC'.
    FREE memory if .---When you free the memory you will get recent data.
    Don't forget to reward if useful.

  • SAP threading-how to pass data between different batch job programs?

    Hi everyone,
        now i have one problem about performance tuning using threading in SAP programs: split one big program into two programs - one is main program and the other is sub program. using batch jobs, we can submit multi jobs of sub program at the same time.
        does anybody know how to pass data between different batch jobs? I don't want to use temp files. can ABAP memory can implement this?
        thanks!

    Passing Data Between Programs
    [http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9df735c111d1829f0000e829fbfe/frameset.htm|http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9df735c111d1829f0000e829fbfe/frameset.htm]

  • How to compare data between two tables?

    Hi,
    My team is trying to develop a SAP data migration tool (DMT) using ABAP.
    One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
    The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
    How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
    Any help would be greatly appreciated, thanks!

    Hi Kian,
    Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
    Thanks,
    Vinay

  • How to transfer data between a multi-thread dll build with LV7 and MS C++, using envent programing method.

    It is easy to transfer data between a simple input/output dll build with LV and an external code like C++, but when data are available inside a loop running in the dll(in fact thread running in LV); How can I read them or receive an handle pointer to the calling C++ application when new data are ready.

    If you're using LabVIEW 7, you can use the PostLVUserEvent function to fire an event for an event structure in LV. Refer to the Using External Code in LV manual.
    Or you could use datasocket for this. The datasocket activex dll is nids.dll. You could have the class wizard generate wrappers for you or if you have Measurement Studio, you could use the custom wrappers it provides to communicate between the VI and dll.
    I hope this helps
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • ODI: How to transfer data between Essbase apps

    Hi,
    I'm using old Planning version 3.5 on Essbase 7.1.6. It has no partition options between apps. XREF function work slowly. I need to transfer data with transformations between two Essbase Apps. I'd like to use ODI 10.1.3.6.4 to do it. I'd like to transfer data between essbase apps via Staging Area.
    1. What units of LKM, IKM, RKM to me need to be used?
    2. How to create datasource for Essbase in ODI?

    I've found "Compatible software: Essbase 7.1.6 (Data Load & Data/Metadata Extract Only)" information here
    http://download.oracle.com/docs/cd/E15985_01/doc.10136/readme/DIHER.pdf
    John, I use your blog as a short ODI guide. Thanx a lot of!
    Besides, I've found "Getting Started with Oracle Data Integrator Adapter for Hyperion Essbase" - informative source
    http://download.oracle.com/docs/cd/E15985_01/doc.10136/getstart/DIAHE.pdf

  • How to transfer data between planning functions in BPS

    Hi All,
    I have requirement, where user will enter the sales qty plan in manual planning function and need to read the zinfo object to distribute the sales qty accordingly to manufacturing plant and push into infocube.
    To fulfill above requirement, i'm thinking to create one manual plan and user will enter the total sales qty and create one more exit planning function to distribute the sales qty for each plant.
    For above approach, i need to get the data enter in mannual planning function to exit planning function.
    Can anyone let me know how to transfer data from one planning function to other planning function under same planning level and package.
    Thanks you,
    santosh.

    Hi Santosh,
    You can achieve the Distribute functionality using the Standard Planning Function for Distribute (Refer SAP Help for details).
    Moreover you would not have to do anything specifically to transfer data from one Planning Function to another. The application picks up the latest data records for processing whatever Function you are executing. If you want to execute a series of Planning Functions you could use a Planning sequence to achieve the same.
    Hope it helps

  • How to Select Data from different Tables Using Linq

    Hi,
    I have two different tables, I just want to collect data from tables using Linq to SQL Queries.
    The tables looks like This 
    ID Name ImageUrl 
    Other Table is
    ID EmpID CheckInTime CheckOutTime 
    What I want to Collect data from CheckInTime and want to place it in a that is in a list view
    Same thing I want to do it for CheckOutTime And One thing I want to tell is both tables are joined by a FK EmpID with ID.
    What Are the suggestions for me 
    I have Used this code
    var data = from emp in db.Employees
    join chk in db.CheckInCheckOuts on emp.ID equals chk.EmpID
    select new EmployeeCheckInOut
    Name = emp.Name,
    ImageUrl = emp.ImageUrl,
    CheckIn = emp.CheckInCheckOuts,
    CheckOut = emp.CheckInCheckOuts
    Here the CheckInCheckOuts is another table, I don't how do I access fields of the Other table "CheckInCheckOuts"
    Thank you
    Ali

    Mitja,
    Kind of Tables, I don't Know but I can Tell you that these are Two table, first Table Have Data in It, Name, ImageUrl I have filled this table with names and ImageUrls And are string type.Other Table is for the CheckInTime And CheckOutTime of the employee.
    What I need that when I click on the Image button it Should displays The Current Datetime into the label below the Image button.
    So I have Problem accessing my CheckInCheckOut Table because I may not have Idea about.Did you understand what I need to do, if you have more question please ask to me.
    Thanks
    Ali

  • How to transfer data between the different states in "state machine"?

    I want to transfer some data from one state to another. I tried the tunnel, but it can't work since it's the case structure. Does "state machince" support data transfer? Or any other methods I can do?
    Thank you.

    Yes, adding a shift register to the outer while loop should work, make sure to initialize it.  Perhaps you could attach your vi so we could have a look at it.  Be sure to give us as much info as to what your goal for the vi is.
    Cheers!
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • How to transfer data between spreadsheets without using Business Objects?

    Hello, every time I try and log onto the business objects platform I keep getting "this system can be contacted but there is no central management server running at port 6400".  All I need to do is pass variables between spreadsheets. Both files are located in the same folder. Below are the links ive tried but have been unsuccessful  to pass data.
    (This link I used the swf loader component child and flash variables task Daya posted on Feb 15. However nothing loaded. The link wasnt a link i could display is in a browser. So i kept getting 0% when in preview mode.
    Passing values from dashboard to dashboard with Flash Variables
    Next I tried the following link. I did everything word for word and was able to display both files on the html page, but no link or connection between them existed. I would select a state and noting happened to the other swf files chart. Does this need to be in the Business Objects platform?
    Dashboards 4.0: Connect to an external
    Lastly , I used the link below. I followed everything and was able to get interaction from the parent to child however with only the files that were available on this thread. Their URL was this http://myxcelsius.com/wp-content/uploads/2010/10/child.swf?salesman=Schrute,Dwight. I get the concatenation but I dont get how this URL was generated? How do I develop my URL? My URL is able to display in a browser. My URL is
    http://kln-ftvp/KLNPheonix//LinkToReport.htm?fqn=MyEnterprise.Public.graphtest&run=true
    SWF Loader shows 100% instead of Dashboard.
    Even with my URL being able to display in internet explorer, I still only show 100% and a blank screen. Can anyone help me with any of the issues I am having trouble with? Your help is most appreciated. Thank you.

    It looks like you have more than one problems so it might be good to separate them out.
    Issue 1 - Logging on to BusinessObjects
    You say that when you try log on to the BO Platform you get the error message there is no central management server running on port 6400. I'm assuming you are trying to do this from the Dashboard designer.
    Does it work when you try to log on from the web browser?
    Make sure that you enter the correct system name in the system field when trying to log on from Designer. If you are unsure, either check what system name is used when you log on from your browser or check with your BO administrator.
    Issue 2 - Passing values to a child dashboard
    If you try to preview the dashboard in the designer, remember that the swf loader doesn't work in preview mode, so whatever you are trying to display won't be visible.
    First of all you need to have 2 separate flash files that works independently of each other. The one that you are planning to use as a child flash, make sure that you create the flash variables so you can pass variables to it and use them to filter your data if that is your requirement. But hold off on that for now.
    When you have 2 working flash files, save them both to the BI Launch Pad (or InfoView if you are on 3.1) and make sure they both work there. Then get the opendocument url for the child dashboard and try to open it in your browser directly using this url. If that works, use the same url in the swf viewer in the parent dashboard, save the parent dashboard back to BI Launch Pad and open it. It should now work.
    Let me know if you have any problems with these steps.
    Cheers,
    Josh

  • HT1296 How to transfer data between 2 iphones while not having the old one

    How can I transfer or sync  all the data from my previous iphone to the new one while not having the first(it's not working due to high voltage problem of the area),and of course not loosing anything?

    Correct, you do not need your old iPhone. All you need is your old iPhone's backup. If you had an old model iPhone and wanted to replace it with a newer one, restoring it from a backup of your older one would be the process you would use.
    Make sure before you start that your new iPhone is either really new or completely erased. If you did not just buy it new, do Settings > General > Reset > Erase all content and settings before restoring it from your old iPhone's backup.

  • How to transfer data between laptops?

    The keyboard on my old MacBook Pro is no longer working.  How do I boot it up, via firewire, from my newer MacBook Pro?  I want to access the data housed on the broken laptop and transfer it to the newer, working one. 

    Hi A,
    MigrationAssistant
    http://support.apple.com/kb/HT4413
    Tipsand Tricks: http://support.apple.com/kb/HT3231
    http://docs.info.apple.com/article.html?path=Mac/10.6/en/27921.html

  • How to transfer data between spreadsheets

    I have created 2 identical spreadshhets and want data changes made in table A to be automatically changed in table B. Can anyone explain how I do that ?
    Thanks

    It looks like you have more than one problems so it might be good to separate them out.
    Issue 1 - Logging on to BusinessObjects
    You say that when you try log on to the BO Platform you get the error message there is no central management server running on port 6400. I'm assuming you are trying to do this from the Dashboard designer.
    Does it work when you try to log on from the web browser?
    Make sure that you enter the correct system name in the system field when trying to log on from Designer. If you are unsure, either check what system name is used when you log on from your browser or check with your BO administrator.
    Issue 2 - Passing values to a child dashboard
    If you try to preview the dashboard in the designer, remember that the swf loader doesn't work in preview mode, so whatever you are trying to display won't be visible.
    First of all you need to have 2 separate flash files that works independently of each other. The one that you are planning to use as a child flash, make sure that you create the flash variables so you can pass variables to it and use them to filter your data if that is your requirement. But hold off on that for now.
    When you have 2 working flash files, save them both to the BI Launch Pad (or InfoView if you are on 3.1) and make sure they both work there. Then get the opendocument url for the child dashboard and try to open it in your browser directly using this url. If that works, use the same url in the swf viewer in the parent dashboard, save the parent dashboard back to BI Launch Pad and open it. It should now work.
    Let me know if you have any problems with these steps.
    Cheers,
    Josh

Maybe you are looking for