Link to home
Start Free TrialLog in
Avatar of hanhn
hanhnFlag for Singapore

asked on

How to make Oracle call external program

Is there anyway for Oracle to call external program whenever a certain data is inserted to the table with the data as parameter to the program? Can Oracle Stored Procedure triggers this kind of call?
Avatar of Ivo Stoykov
Ivo Stoykov
Flag of Bulgaria image

The simplest way is using The HOST Command
usage: Host <external program> <params>
Check SQLPlus documentation for longer description or
read this adticle
HTH
i
SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sean Stuber
Sean Stuber

schwertner's post should work,
it's effectively the same thing I posted except it forces cmd/sh use (depending on the operating system) and it doesn't capture any of the output from those commands.

however, most dba's wouldn't allow it (or at least, they shouldn't)

if you can run cmd/sh then you can run anything that the oracle process owner can run.

it's more secure to grant exactly the access you need to the programs you want to run.
and most dba's will (hopefully) grant only what you need and not a "run anything" set of privileges.

if you are the dba and will be granting this to yourself,  then make sure you keep the procedure locked down so nobody else can use it.

I recommend a split with schwertner and myself (sdstuber)

schwertner posted basically the same thing I posted earlier
but with a few minor differences

schwertner's version makes command line access easier but has weak security.  So, good and bad.
mine is more secure but less convenient since you have to have expicit access granted for each program.

I also gave 2 other suggestions
no problem, glad I could help!