Re: PL/SQL function to execute an OS command

From: Tom Zamani <tomz_at_redflex.com.au>
Date: Mon, 3 Apr 2000 16:03:03 +1000
Message-ID: <8c9ck6$hht$1_at_perki.connect.com.au>


What you need to use is called external procedure call. I am using it at the moment to send out emails, execute shell commands etc. it is very fast and works ok.

there are few steps to take.
1- write a c program which call the system and get the object file 2- create a shared object from the c funcation ( eg. ld -G syscall.o -o syscall.so)
3- create a library in oracle (create library exproc as 'full patch to syscall.so')
4- wite a plsql wrapper function which executes the function in the library. Function SYSRUN
  ( syscomm IN varchar2)
  RETURN binary_integer AS external
    LANGUAGE C
    NAME "sysrun" --name of the function in your c program     LIBRARY exproc;

then execute the function within a procedure.

good luck

TOM Peter Rieckmann <prieckmann_at_stthomas.edu> wrote in message news:38E51823.F14804C8_at_stthomas.edu...
> Hi,
>
> I am looking for a function that I could use to execute
> a Unix command with in a PL/SQL block. Similar to the "$" in sqlplus.
> Has any one see/user on of those functions?
>
> Thanks
>
> peter rieckmann
> prieckmann_at_stthomas.edu
>
Received on Mon Apr 03 2000 - 08:03:03 CEST

Original text of this message