Transaction

ank123

New Member
do transaction:
for each customer exclusive-lock:
update customer.
end.
end.

Consider that there is some problem occured while updating the 5th record. What will happen in this case?
Will updation for all the 5 records be rollbacked of just for 5th record?

I'm having doubt because for each ... end. will be acting as sub transaction here.

Kindly advise.

Thanks
 

ank123

New Member
Does this mean, if error occurs at 5th record iteraton then updation for all 5 records will be roll backed?

I am new to progress, so Kindly eleborate this on me.
Could you please provide me some good examples on transaction scenerios?

Thanks in advance.
 
If there is an error it ordinarily roll back whole transaction. But, in some cases it can rollback only subtraction. I am not sure in this case. To be sure use direct transaction control.

L:
Do transaction on error, undo, leave l:
End.
 

tamhas

ProgressTalk.com Sponsor
Yes, if you scope the transaction to encompass all the updates, then an error or explicit undo will undo all of the work. As Tom says, test it. It is quite easy to write such a thing against sports or whatever to make a huge number of changes and then explicitly undo and exit and check the values after this is done.

Note that NO-UNDO variable are not undone.

Note too that one generally tries hard to avoid doing something like this because the number of locked records can be very large. There has to be a really compelling business case.
 
Top