I’m coding a VB app that will transfer data from one of our legacy system into Oracle8i.
The data will basically have 2 levels.
ACCOUNTS
CONTACTS
The account records being the top level will be selected based on certain criteria anything that is related to this account will be considered a contact.
I coded a loop that selects all the accounts and inserts them. If anything is related to it, it gets inserted in a nested loop.
Example:
Do Until rsa.EOF
Insert account
Insert account address1
Insert account address2
Insert account cross-referenceids
For i =1 to rsc.RecordCount 'the recordset rsc selects all the records that are related to the accountid
Insert contact
Insert contact address1
Insert contact address1
Insert contact referenceid's
rsc.MoveNext
Next
rsa.MoveNext
Loop
My question:
Say an error occurs, I'm left with only half of the contact for that account. My program will not know where it left off when the error occured. What I'm wanting to do is use the Transaction, Rollback, Commit functions/events. If an error occurs, rollback all the records that were just inserted else if successful commit.
Hope this seems logical enough...
Thanks for any help
