A SQL statement that runs successfully is different from a committed transaction.
Executing successfully means that a single statement was:
■ Found to be a valid SQL construction
■ Run without error as an atomic unit. For example, all rows of a multirow update
However, until the transaction that contains the statement is committed, the
transaction can be rolled back, and all of the changes of the statement can be undone.
A statement, rather than a transaction, runs successfully.
Committing means that a user has explicitly or implicitly requested that the changes
in the transaction be made permanent. An explicit request occurs when the user issues
a COMMIT statement. An implicit request occurs after normal termination of an
application or completion of a data definition language (DDL) operation. The changes
made by the SQL statement(s) of a transaction become permanent and visible to other
users only after that transaction commits. Queries that are issued after the transaction
commits will see the committed changes.
You can name a transaction using the SET TRANSACTION ... NAME statement before
you start the transaction. This makes it easier to monitor long-running transactions
and to resolve in-doubt distributed transactions .
1. SQL语句的成功执行与一个提交的事务的区别在于前者 :
被解析 , 成为一个有效的SQL结构 , 作为一个原子单位运行没有错误 .
2. 提交以为着用户请求对事务中的改变变为永久性 , 修改后的数据对其他用户可见
3. 可以使用SET TRANSACTION ... NAME为事务命名 , 来监控长时间运行和解决拿不准的分布式事务
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/10599713/viewspace-980760/，如需转载，请注明出处，否则将追究法律责任。