且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在oracle触发器中运行exe文件

更新时间:2022-12-03 11:59:17

对DBMS_SCHEDULER的调用将尝试提交,因此除非您与之一起使用,否则从触发器内部无法使用自主交易。这很丑陋,但是您可以创建一个调用shell命令/可执行文件的Java存储过程。

Calls to DBMS_SCHEDULER will try to commit, so won't work from inside a trigger unless you go with autonomous transaction. It is ugly, but you can create a Java Stored Procedure that invokes the shell command / executable.

有一个完整的示例:

https://oracle-base.com/ article / 8i / shell-commands-from-plsql

但是,我建议您在可能的情况下使用纯PL / SQL进行通知(也许调用Web API(如果您正在执行类似发送SMS的操作)。

However, I'd recommend you use straight PL/SQL for your notification if possible (perhaps calling a Web API if you are doing something like sending an SMS).