Compared to Oracle transaction processing, MYDQL is relatively simple, but the transaction as an important security mechanism in the database is essential, especially the inside of the transaction rollback mechanism is very useful, not to mention, first say the MySQL transaction processing:
MySQL Simple rollback:
First step: Start the transaction: starting transaction;
Step Two: Perform other change operations such as DML.
Step three: Roll to the previous state before starting the transaction: rollback;
This way, after execution, it is found that some of the previous operations have not been executed successfully. It is only after commit commits that the data is actually submitted. However, there are two things to consider, one is the service shutdown situation, so that our data rollback in the case of no commit is really going to execute, there is a rollback is able to use once, again use although not error, but do not play any role.
If you would say that I would like to implement multiple rollbacks in a transaction China, here you can use the set SavePoint:
In the second step above, you can do this: savepoint save point 1 (name only);
Then you continue to execute DML, to Nou a place to continue savepoint save point 2;
Do you want to scroll to the previous state by rollback to save the point. But, I have to tell you, want to think about and show the situation is not exactly the same, you will find only can roll to the first save point, the other save point will not exist!
Transaction Processing for Oracle:
Oracle does not have to explain open transactions, for DML statements, when you set the SavePoint, the next step is to return to the categorization malleability point on the same commit transaction with commit.
However, I have summed up an important principle here: transaction rollback can only reverse the direction of retrograde, the process has been irreversible. Unless you commit the end transaction.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Transaction processing mechanism for Oracle and MySQL data