Re: Can I Exec system commands in PL/SQL?
From: Tom Zamani <tomz_at_redflex.com.au>
Date: 2000/02/11
Message-ID: <87vjcb$mu9$1_at_perki.connect.com.au>#1/1
Date: 2000/02/11
Message-ID: <87vjcb$mu9$1_at_perki.connect.com.au>#1/1
I do not know if there is any packages in oracle to do this, BUT
you can use what is called external procedures.
using external procedures you can execute c functions from PL/SQL.
in you case you have to create an external procedure which executes
system('ls -al').
steps to do this.
first make sure exproc is configured for you server.
Write a C function which executes system('blah blah').
compile the C function
create a shared object from it like ld -G Myfunction.c -o Myfunction.so
Note the name of the function in your Myfunction.c (SystemCall)
-- in oracle create a library create library shell_lib as 'full path to you shared object' create a wrapper function something like create or replace Function SYSRUN ( syscomm IN varchar2) RETURN binary_integer AS external LANGUAGE C NAME "SystemCall" LIBRARY shell_lib; now from Oracle you can execute sysrun('command') your command could be like ls -al(won't get you any where) or execute a shell script Well Good luck. Tom David M. Luo <mluo_at_yesic.com> wrote in message news:1Xzo4.3437$w_6.4693_at_news2.randori.com...Received on Fri Feb 11 2000 - 00:00:00 CET
> Hi ALL,
>
> How can I use system commnads or utilities like shell scripts in PL/SQL?
> Like in Sql*plus, we can use HOST to exec system commands. Is there any
> package in PL/SQL to perform such a task?
>
> Thanks for any reply!
>
> Ming
>
>