某些语句无法回滚。一般来说,这些包括数据定义语言 (DDL) 语句,例如创建或删除数据库的语句,以及创建、删除或修改表或存储例程的语句。Some statements cannot be rolled back. In general, these include data definition language (DDL) statements, such as those that create or drop databases, those that create, drop, or alter tables or stored routines.
你应该设计事务时不要包含这些语句。如果在事务早期执行了无法回滚的语句,然后后续的另一个语句失败,在这种情况下通过执行ROLLBACK语句无法回滚事务的全部效果。You should design your transactions not to include such
statements. If you issue a statement early in a transaction that
cannot be rolled back, and then another statement later fails, the
full effect of the transaction cannot be rolled back in such cases
by issuing a
ROLLBACK
statement.