Current version of data in database has changed since user initiated update process error occurs when deleting multiple rows

huangapple go评论81阅读模式
英文:

Current version of data in database has changed since user initiated update process error occurs when deleting multiple rows

问题

在Oracle APEX 22.1中,我遇到了“在用户启动更新过程后,数据库中的数据当前版本已更改”的错误,该错误出现在删除行时。

我的交互式网格包含具有主行和一些详细行的行,都在同一网格中。
因此,根据触发器中的业务逻辑,仅删除主行将自动删除网格中的所有子行。
然而,在选择网格上的所有行并删除它们时,会出现上述错误。
我认为这是因为在数据库中,由于触发器的原因,行已被删除,而APEX引擎无法找到这些行。

是否有任何可以进行的调整的想法?

我尝试添加验证以检查行是否存在,但无法真正实现该怎么做。

英文:

In Oracle APEX 22.1, I am facing "Current version of data in database has changed since user initiated update process." error on deleting the rows.

My Interactive grid contains rows which has master row and few detail rows in the same grid.
So, according to the business logic in the trigger, deleting just only the master row deletes all the child rows automatically in the grid.
However, on selecting all the rows on the grid and deleting them, throws the above error.
I am assuming it is because in the DB, because of the trigger the rows are already deleted and APEX engine is unable to find those rows.

Any idea if there is any tweak that can be done?

I tried adding Validations to check, if the row exists or not. But could not really achieve what to do.

答案1

得分: 1

这听起来像是预期行为。交互式网格试图删除这些行,但当它尝试删除它们时,失去更新检测机制会注意到这些行的状态与交互式网格呈现之前不同。状态已更改,因为触发器删除了这些行,所以交互式网格不再能够删除它们。

交互式网格无法知道这种更改是由另一个进程还是由另一个用户同时更改数据引起的。如果是因为另一个用户在同时操作数据,那么错误消息是合适的。

解决方案是使用自定义进程而不是原生的交互式网格进程。这里有一个描述如何实现的博客

英文:

This sounds like expected behaviour. The interactive grid is trying to delete the rows but when it tries to delete them the lost update detection mechanism will notice that the state of the rows is not the same as before the interactive grid was rendered. The state changed because the trigger deleted the rows so the can no longer be deleted by the IG.
The IG cannot know if the change was caused by an another process or by another user changing data at the same time. If it was because another user manipulated the data at the same time, the error message would be appropriate.

A solution would be to use a custom process instead of the native IG process. Here is a blog describing how you could do that.

huangapple
  • 本文由 发表于 2023年2月27日 14:53:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75577473.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定