简体   繁体   中英

How to run batch file from within PL/SQL procedure

I have a batch file which will execute some .exe which do some operations (like connecting to DB, fetching data, insert data etc...)
All the things are configured in the batch file and when I run it, it works good.

But, I want to invoke this batch file from a PL/SQL procedure .
this procedure should invoke this batch file first, and after the execution of the batch file, it will have it's own SQL operations.

How can I proceed to do this?

Set up a job with dbms_scheduler. This topic is discussed here (German): http://db-memory.blogspot.ch/2012/12/dbmsscheduler-mit-executable-unter.html The screenshots may be helpful.

Please remember to enable the dbms_scheduler job, else it won't run.

You can write your own stored java class with a method which implements running an OS executable file. You should grant to your oracle user java.io.FilePermission and java.lang.RuntimePermission with DBMS_JAVA.GRANT_PERMISSION procedure. Then you should create a plsql function-wrapper which calls your java method. And all you should do for running an OS eecutable is to run your plsql wrapper function.

There is an "AskTom" page about it here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM