Later , you run a rollback transaction savepoint name statement to roll back to the savepoint instead of rolling back to the start of the transaction 然后,运行rollback transaction savepoint _ name语句回滚到保存点,而不是回滚到事务的开始。
The topics in this section describe how the jdbc driver supports transactions including isolation levels , transaction savepoints , and result set holdability 本节中的主题介绍jdbc驱动程序如何支持包括隔离级别、事务保存点和结果集可保留性的事务。
Method . in the following example , a savepoint is used while performing a local transaction consisting of two separate statements in the 对sql server 2005 adventureworks示例数据库中的production . scrapreason表运行这些语句,然后使用保存点回滚第二条语句。
Block . the statements are run against the production . scrapreason table in the sql server 2005 adventureworks sample database , and a savepoint is used to roll back the second statement 该语句将根据sql server 2005 adventureworks示例数据库中的表production . scrapreason来运行,并使用保存点回滚第二个语句。
The use of a savepoint to roll back part of a transaction in the case of an infrequent error can be more efficient than having each transaction test to see if an update is valid before making the update 在不频繁发生错误的情况下使用保存点回滚部分事务,其效果好于在执行更新前测试各事务以查看更新是否有效。
Updates and rollbacks are expensive operations , so savepoints are effective only if the probability of encountering the error is low and the cost of checking the validity of an update beforehand is relatively high 更新和回滚都是耗费大量资源的操作,因此,仅当遇到错误的可能性很低,且预先检查更新有效性的成本相对较高时,保存点才会有效。