gpt4 book ai didi

oracle - oracle中的异步操作

转载 作者:行者123 更新时间:2023-12-02 08:21:12 25 4
gpt4 key购买 nike

有没有办法可以在 oracle 中运行异步操作。

Here is my situation: I have an expensive proc (say it takes 30 mins to run). I have a web-based front-end that controls when this proc to run. I am looking for triggering the running of the proc from the front-end, and not really wait for the proc to complete.i.e., the control should come back to the web application, with a status like say "In progress". I am specifically looking for a mechanism to get control back to the front-end without waiting for the proc to complete execution.

提前致谢,

SK

最佳答案

我同意 OMG Ponies 的要求,了解更多细节。

根据您想要完成的任务,您可能需要查看 DBMS_JOBS 包。这允许您向异步运行的数据库提交作业。例如,如果您希望数据库执行一些计算成本较高的操作来响应 GUI,您的前端可以执行类似的操作

CREATE OR REPLACE PROCEDURE run_asynchronously( p_some_parameter IN PLS_INTEGER, 
p_jobno OUT PLS_INTEGER )
AS
BEGIN
dbms_job.submit( p_jobno,
'BEGIN ' ||
' some_expensive_procedure( ' ||
to_char(p_some_parameter) || ' ); ' ||
'END;' );
RETURN p_jobno;
END;

这将提交一个后台作业来运行 SOME_EXPENSIVE_PROCEDURE,并传入 P_SOME_PARAMETER。在底层事务提交之前,作业不会启动,如果 SOME_EXPENSIVE_PROCEDURE 执行一些无法回滚的操作(例如发送电子邮件或 FTP 传输文件),则非常好。

关于oracle - oracle中的异步操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4128528/

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