示例来源于MOS,按需修改使用。
源码:
CREATE OR REPLACE PROCEDURE parent2 ( errbuf OUT VARCHAR2, retcode OUT NUMBER ) IS i NUMBER; req_data VARCHAR2(10); r NUMBER; BEGIN -- -- Read the value from REQUEST_DATA. If this is the -- first run of the program, then this value will be -- null. -- Otherwise, this will be the value that we passed to -- SET_REQ_GLOBALS on the previous run. -- req_data := fnd_conc_global.request_data; -- -- If this is the first run, we'll set i = 1. -- Otherwise, we'll set i = request_data + 1, and we'll -- exit if we're done. -- IF (req_data IS NOT NULL) THEN i := to_number(req_data); i := i + 1; IF (i < 11) THEN errbuf := 'Done!'; retcode := 0; RETURN; END IF; ELSE i := 1; END IF; -- -- Submit the child request. The sub_request parameter -- must be set to 'Y'. -- r := fnd_request.submit_request('FND', 'FNDSCARU', 'Child ' || to_char(i), NULL, TRUE, fnd_conc_global.printer); IF r = 0 THEN -- -- If request submission failed, exit with error. -- errbuf := fnd_message.get; retcode := 2; ELSE -- -- Here we set the globals to put the program into the -- PAUSED status on exit, and to save the state in
-- request_data. -- fnd_conc_global.set_req_globals(conc_status => 'PAUSED', request_data => to_char(i)); errbuf := 'Sub-Request submitted!'; retcode := 0; END IF; RETURN; END; / |
以下内容截取实际工作中源码,仅做示例展示部分源码
FOR l_calc_type IN calc_type LOOP l_request_id := NULL;
IF p_segment1 IN ('1110', '1101', '1102', '1111', '1113') AND l_calc_type.flex_value = 'AR-AGING' THEN l_request_id := fnd_request.submit_request(application => 'CUX', program => 'CUXBPCDATACLCT_SA', description => NULL, start_time => SYSDATE, sub_request => TRUE, argument1 => p_segment1, argument2 => p_period_name, argument3 => l_calc_type.flex_value);
ELSE l_request_id := fnd_request.submit_request(application => 'CUX', program => 'CUXBPCDATACLCT', description => NULL, start_time => SYSDATE, sub_request => TRUE, argument1 => p_segment1, argument2 => p_period_name, argument3 => l_calc_type.flex_value); END IF;
IF l_request_id > 0 THEN fnd_conc_global.set_req_globals(conc_status => 'PAUSED', request_data => l_request_id); COMMIT; l_request_id := l_request_id; errbuff := '已成功调用请求,请求号为:' || l_request_id; retcode := 0; ELSE ROLLBACK; l_request_id := 0; errbuff := '调用请求失败,稍后重试!'; retcode := 2; END IF; END LOOP; |