gpt4 book ai didi

sql - 是否建议在 Oracle EBS 并发程序中提交一个 Commit?

转载 作者:行者123 更新时间:2023-12-04 17:56:23 28 4
gpt4 key购买 nike

我只是想问一下,在 Oracle EBS 并发程序调用的 PL/SQL 过程中放置​​一个 Commit 是否可取?我一直认为将提交放入程序中是一种不好的做法,原因如下:

  1. If the Program encounters an Exception after the Commit, we cannot Roll it back anymore.
  2. Let the calling application do the implicit commit (in this case, EBS)
  3. As in the case of Oracle Workflows, we should never put Commits inside the WF package as it will disrupt the "rollback" feature of the Workflow.

但是,我不断看到 Oracle EBS 开发人员将提交放入单个并发程序中。对此有什么想法吗?

谢谢!

最佳答案

别担心,你做得对。数据库开发人员在投入生产之前并不知道很多事情。避免代码内部的 COMMIT 是为了使该代码能够与其他代码单元一起使用,而不会破坏整个系统逻辑。回滚不仅涉及异常,还涉及用户在不破坏数据库的情况下取消交互式程序中的操作的自由。

下面是一个开发人员(unit_2 的开发人员)自由使用 COMMIT 时发生的情况的示例。

create table t (i int);

create or replace procedure unit_1 as begin insert into t(i) values (1); end;
/
create or replace procedure unit_2 as begin insert into t(i) values (2); commit; end;
/
create or replace procedure unit_3 as begin insert into t(i) values (3); end;
/
create or replace procedure unit_4 as begin insert into t(i) values (4); end;
/

create or replace procedure all_units as begin delete t;unit_1;unit_2;unit_3;unit_4; end;
/

exec all_units;

select * from t;

         I
----------
1
2
3
4

set transaction t; exec all_units; rollback;


select * from t;

         I
----------
1
2

关于sql - 是否建议在 Oracle EBS 并发程序中提交一个 Commit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40248501/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com