Home » SQL & PL/SQL » SQL & PL/SQL » how to call Unix executable from sql plus
how to call Unix executable from sql plus [message #213578] Thu, 11 January 2007 05:45 Go to next message
Messages: 5
Registered: January 2007
Junior Member
Hi, I have a .sql file in which I am getting few records in a cursor. I need to call a unix level utility (executable) in the FOR loop for each of the record fetched. Can you please tell how to do this. (call/executable shell script from sql)
This shell script does take some input parameters.
Thanks !
Re: how to call Unix executable from sql plus [message #213591 is a reply to message #213578] Thu, 11 January 2007 06:37 Go to previous message
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Well you can't call an *nix executable from sqlplus in a for loop i.e. You cant "mix" the SQL with OS command calls.

I think you could write a java stored procedure for this purpose, but i requires a bit of work.

What you could do is to fetch the records , and spool them to a file.Then process that file.

Good to know
When you want to run an OS command from sqlplus you can take advantage of the host command, which will be started as a child processes to sqlplus.

SQL> host /export/home/omwb/script/myscript.sh

SQL> host ls
afiedt.buf omeuse.sh test1.sh myscript.sh

Good Luck
Previous Topic: how to check when a materialized view was refreshed last
Next Topic: Alternative Logic for Performance Enhancement!!!
Goto Forum:

Current Time: Fri Aug 18 00:12:31 CDT 2017

Total time taken to generate the page: 0.08802 seconds