Until you commit a transaction on the database, you can rollback to the previous commit state. Once you have committed a transaction, this opportunity to undo is lost. To undo after that, you must make changes under your own script's control. That means that if you anticipate that possibility, you will need to remember the previous values. On the whole, it's easier to let the database do this and to only commit when you are sure the transaction is complete and correct.