是否建议在 Oracle EBS 并发程序中提交一个 Commit?
Advisable to put a Commit in an Oracle EBS Concurrent Program?
我只是想问一下是否建议将 Commit 放入 PL/SQL Oracle EBS 并发程序调用的过程?我一直认为将提交放入程序中是一种不好的做法,原因如下:
- If the Program encounters an Exception after the Commit, we cannot Roll it back anymore.
- Let the calling application do the implicit commit (in this case, EBS)
- 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
我只是想问一下是否建议将 Commit 放入 PL/SQL Oracle EBS 并发程序调用的过程?我一直认为将提交放入程序中是一种不好的做法,原因如下:
- If the Program encounters an Exception after the Commit, we cannot Roll it back anymore.
- Let the calling application do the implicit commit (in this case, EBS)
- 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