Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2006
    Posts
    8

    Unanswered: Copying data from Temp Tables to real tables

    Hi all,

    Here is my problem. I have some temporary tables which have data. I want to copy all of these data into corresponding original tables. Put in simple words, I need to copy data off some tables to some other. I am planning to achieve this task using Hibernate. Which is the best options out of the following ?

    1) Execute a Stored Procedure using Hibernate to do the copying.

    2) Write the script for copying in an sql file and execute the sql file from inside Hibernate.

    Which has more performance and is the right way to do it ?

    thanks in advance,
    vinodtr

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    If the "original tables" are empty, you could even RENAME a "temporary" table into the "original" one.

  3. #3
    Join Date
    Dec 2006
    Posts
    8
    The architecture is like this. There is an already working application. I need to build an existing module afresh. So, when i am re-implementing this new module, I wont insert the data directly into the old tables. I will insert all the data entered in some temp tables. When the processing is complete, at the last step, I copy all these temp data into the original old tables.

    There are around 10 Temp tables. This data needs to be distributed across 20 odd tables in the old database based on conditions.

    Now ?

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >There is an already working application.
    Is the application online while you are messing with the temp tables?

    >I need to build an existing module afresh.
    To what end? Why?


    >So, when i am re-implementing this new module, I wont insert the data directly into the old tables.
    >I will insert all the data entered in some temp tables.
    To what end & why move the data twice?


    >When the processing is complete, at the last step, I copy all these temp data into the original old tables.
    Never confuse movement with progress.
    Going around in circles is movement, but few consider such activity as progress.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Dec 2006
    Posts
    8
    Application will be online when I insert data into the Temp tables.

    The existing module is faulty and needs reimplementation

    I dont want to tinker with the original tables. Thats why I have gone in for TEMP tables before I insert the data into the original tables.

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    I contend that your approach is doomed to failure.
    Just make sure you have good backups before you run your code against the DB & that the application users maintain suitable paper notes to reenter data after you restore from backups.

    It appears to me you'll be attempting to change a flat tire while the car is still going down the road.

    I'll be impressed if you succeed.

    BTW, use straight SQL & don't even consider PL/SQL; row by row is slow by slow!
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •