Oracle External Procedure to Run Host Commands
One common piece of framework I have always needed when writing Oracle based applications is the ability to execute a host command in line with my PL/SQL code. Sometimes I do something as simple as echo a value to a file, to more complex shell scripts for calling programs to render PDF’s, send emails, etc. One requirement of executing host commands on the database server is to also get the return code from the process I just called so my PL/SQL program can take an appropriate course of action.
To do this, I use a simple oracle external procedure. The example I’m presenting below has been tested and used on Oracle 10gR2 and RedHat Linux AS3.
Here’s how it works: continue reading…