Right now the process that we're using for inserting sets of records is something like this:
(and note that "set of records" means something like a person's record along with their addresses, phone numbers, or any other joined tables).
- Start a transaction.
- Insert a set of records that are related.
- Commit if everything was successful, roll back otherwise.
- Go back to step 1 for the next set of records.
Should we be doing something more like this?
- Start a transaction at the beginning of the script
- Start a save point for each set of records.
- Insert a set of related records.
- Roll back to the savepoint if there is an error, go on if everything is successful.
- Commit the transaction at the beginning of the script.
After having some issues with ORA-01555 and reading a few Ask Tom articles (like this one), I'm thinking about trying out the second process. Of course, as Tom points out, starting a new transaction is something that should be defined by business needs. Is the second process worth trying out, or is it a bad idea?