5

I have table hierarchy as follows

Table A - Root level
     Table B - Child of A
     Table C - Child of A
     Table D - Child of A

I am inserting all the related rows in a single Commit transaction. The order of the insert statements are as follows. Thus, the insert statement to the root table is last in the list. When in this case, I am getting the error "Row [*******] in table A was already created in this transaction.

   -- Insert  B
   -- Insert  C
   -- Insert  D
   -- Insert  A

I had to change the insert order in such a way that, the Root Table row is first in the list to get rid of the error.

Obviously, it suggests that the order of insert statements in a Commit statement is important especially with the interleaved tables. However, I couldn't find this in any documents. Can someone please point me if this is documented somewhere.?

Maxim
  • 4,075
  • 1
  • 14
  • 23
  • 2
    You are right, the parent record must be inserted first. Looks like we don't explicitly tell that in the documentation, we are going to fix this, thanks! – Mairbek Khadikov Oct 09 '17 at 23:09

0 Answers0