受回滚影响的行数
我需要找出受回滚影响的行数。 我怎样才能得到这个?请帮忙。
I need to find out the number of rows affected by a rollback.
How can I get this ? Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我需要找出受回滚影响的行数。 我怎样才能得到这个?请帮忙。
I need to find out the number of rows affected by a rollback.
How can I get this ? Please help.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
考虑一个具有两列(id,值)和两行的表 fred。
第一行是 (1,'Blue'),第二行是 (2,'Blue')
我发出以下语句
表中最初的两条记录均已更新。 1更新了两次。插入一行然后更新。然后所有这些更改都被回滚。问题是,你想要什么数字?更新的记录数,或对记录执行的更新总数。
从技术角度来看,最简单的答案是统计 应用的撤消记录数。但你必须在之前和之后进行测量。实际上,它可能会变得非常令人困惑,因为对于涉及并发活动的 UPDATE 语句,语句可能会中途停止、回滚并重新启动。参考 AskTom
Consider a table fred with two columns (id, value) with two rows.
The first row is (1,'Blue') and the second is (2,'Blue')
I issue the following statements
Both records originally in the table have been updated. 1 was updated twice. One row was inserted and then updated. Then all those changes were rolled back. The question is, what number do you want ? The number of records updated, or the total number of updates performed to records.
The easiest answer to get, from a technical point of view, is the statistic number of undo records applied. But you'd have to measure this before and after. Actually, it can get very confusing because with an UPDATE statement that hits concurrent activity, a statement may be stopped part way through, rolled back and restarted. Ref AskTom
实际上,受回滚影响的行数零。这是因为,从技术上讲,这些行在提交发生之前不会更改(
ACID
中的A
)。而且,如果您回滚,则不会发生提交。Actually, the number of rows affected by a rollback is zero. That's because, technically, those rows aren't changed until a commit occurs (the
A
inACID
). And, if you're rolling back, the commit doesn't happen.我不知道如何使用 Oracle 执行此操作,但您可以使用
SQL%ROWCOUNT
跟踪创建/更改/删除的行,这样您就知道回滚中会影响什么I dont know of a way to do this with oracle, but you could potentially keep track of your created/altered/deleted rows using
SQL%ROWCOUNT
so you know what will be affected in a rollback