提交并发请求时使用FUNCTION FND_CONCURRENT.WAIT_FOR_REQUEST等待子并发程序完成

在提交并发请求的时候,有些情况需要调用其他的并发程序去处理相应的事务,此时父并发请求进入等待状态,当子程序完成之后接着去处理其他的业务,为了实现这种情况需要使用到FUNCTION FND_CONCURRENT.WAIT_FOR_REQUEST 这个功能。

示例
 log('begin call Import Standard Purchase Orders');
    l_request_id := fnd_request.submit_request('PO',
                                               'POXPOPDOI',
                                               '',
                                               to_char(SYSDATE, 'YYYY/MM/DD HH24:MI:SS'),
                                               FALSE,
                                               NULL,
                                               'STANDARD',
                                               NULL,
                                               'N',
                                               NULL,
                                               'INCOMPLETE', --'APPROVED',
                                               NULL,
                                               NULL,
                                               lt_org_id,
                                               NULL,
                                               chr(0));
    log(l_request_name || ' Interface Request Submmit.l_request_id=' || l_request_id);
    COMMIT;--注意这个commit需要写上,不然会有问题
l_wait_req   := fnd_concurrent.wait_for_request(request_id => p_request_id,
                                                    INTERVAL   => 1,
                                                    max_wait   => 1000,
                                                    phase      => l_child_phase,
                                                    status     => l_child_status,
                                                    dev_phase  => l_dev_phase,
                                                    dev_status => l_dev_status,
                                                    message    => l_message);
    x_wait_req   := l_wait_req;
    x_dev_phase  := l_dev_phase;
    x_dev_status := l_dev_status;
    x_message    := l_message;

fnd_concurrent.wait_for_request 参考
Problem Description:

The following describes how to submit concurrent requests using PL/SQL and
have the parent request ‘wait’ until each of the child processes have
completed before it completes.

Search Words: WAIT_FOR_REQUEST phase status arguments interval

Solution Description:

When submitting concurrent requests using PL/SQL, it is often desired to have
the parent process wait until all the child processes have completed before
completing itself. The following describes the function used to accomplish
this.

Use the FND_CONCURRENT.WAIT_FOR_REQUEST function documented in the Oracle
Applications Developer’s Guide, RELEASE 11i, Page 21-8 See the FND_CONCURRENT.WAIT_FOR_REQUEST
function description.

Summary
FUNCTION FND_CONCURRENT.WAIT_FOR_REQUEST

(request_id IN number default NULL,
interval IN number default 60,
max_wait IN number default 0,
phase OUT varchar2,
status OUT varchar2,
dev_phase OUT varchar2,
dev_status OUT varchar2,
message OUT varchar2) return boolean;

Description
Wait for the request completion, then return the request phase/status and
completion message to the caller. Also call sleep between database checks.

Arguments (input)

request_id
The request ID of the program to wait on.

interval
Time to wait between checks. This is the number of seconds to sleep.
The default is 60 seconds.

max_wait
The maximum time in seconds to wait for the requests completion.

Arguments (output)

phase
The user friendly request phase from FND_LOOKUPS.

status
The user friendly request status from FND_LOOKUPS.

dev_phase
The request phase as a constant string that can be used for program
logic comparisons.

dev_status
The request status as a constant string that can be used for program
logic comparisons.

message
The completion message supplied if the request has completed.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值