4 Replies Latest reply: Oct 4, 2013 9:40 AM by bencol RSS

    Insert violating constraints and fix later?

    Arijit Kanrar

      Using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit.

      PL/SQL Release 10.2.0.4.0 - Production

       

      I have a requirement to create a copy of an existing record and all its child records. Now instead of using loops for each child and creating those records individually I can make it faster by just performing an INSERT INTO ... SELECT FROM ... and update the required IDs.

      The problem is immediately after the insert and before updating the IDs, the data violates the integrity constraints. My update would fix this but I cannot perform the insert without disabling the integrity constraints first. Disabling the constraints is something I dont want to do as it potentially allows other users to create invalid data.

       

      Is there a way to insert some records in a table without "posting" the inserts immediately?

      So that I can update the IDs and then post the inserts so that the data remains valid?

       

      Regards,

      Arijit Kanrar