Hi,
I have over 200,000 rows of data which I need to insert into a DB table on a daily basis. Some of these rows may update one row in the DB or may create new rows depending on the incoming data.
What is the best way of doing this?
Option 1:
I was thinking of using a FOR LOOP and in it I would first try and update the row, if this has a SQL%ROWCOUNT of 0 then I'll do an insert. -- this would mean looping 200,000 times.
Option 2:
I will do a FORALL and do an UPDATE for all rows, then immediately after do a FORALL with an INSERT for all rows. -- this way would mean looping 400,000 times.
Would the FORALL method still be quicker?
Is there another way of implementing this?
Cheers,
toddyl
I have over 200,000 rows of data which I need to insert into a DB table on a daily basis. Some of these rows may update one row in the DB or may create new rows depending on the incoming data.
What is the best way of doing this?
Option 1:
I was thinking of using a FOR LOOP and in it I would first try and update the row, if this has a SQL%ROWCOUNT of 0 then I'll do an insert. -- this would mean looping 200,000 times.
Option 2:
I will do a FORALL and do an UPDATE for all rows, then immediately after do a FORALL with an INSERT for all rows. -- this way would mean looping 400,000 times.
Would the FORALL method still be quicker?
Is there another way of implementing this?
Cheers,
toddyl