Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to execute Unix Command/program within a pl/sql block.
Hi,
you can't do this from PL/SQL but you can do it from Java and it's fairly easy
too. I'm not able to check the name of the class tht does it but armed with the
phrase "java os command" and either the Metalink or "Ask Tom" web site you
should be able to track it down.
Regards,
Mike
|--------+----------------------->
| | Stephane |
| | Faroult |
| | <sfaroult_at_ori|
| | ole.com> |
| | |
| | 07/10/01 |
| | 12:20 AM |
| | Please |
| | respond to |
| | ORACLE-L |
| | |
|--------+-----------------------> >------------------------------------------------| | | | To: Multiple recipients of list | | ORACLE-L <ORACLE-L_at_fatcity.com> | | cc: (bcc: Mike Hately/ETECH) | | Subject: Re: How to execute Unix | | Command/program within a pl/sql block. | >------------------------------------------------|
Seema Singh wrote:
> > Hi > How to execute unix command in PL/SQL ? > Thanks in advance. > -Seema
You can't. The nearest you can get is to write a daemon program which waits for commands on a (dbms) pipe, executes them (popen(), while(fgets()) {}, pclose() in C) and feeds the output back to the pipe. Needless to say, it can be a serious security gap if you do not screen the commands, since you are likely to execute them with the privileges of the user under which the said program is run. Many moons ago, there used to be something named 'flex' developed by Oracle consultants and freely available on the web which was more or less doing that. It may or may not still be around. I have had a look at it after having developed my own (in Pro*Fortran and under VMS, nothing stops me - no pipe, but a /OUTPUT=... was appended to the command and I was reading and sending back the ouput file) and I can tell you that Flex was unnecessarily complicated. To make simple seems very difficult to many people.
-- Regards, Stephane Faroult Oriole Corporation Voice: +44 (0) 7050-696-269 Fax: +44 (0) 7050-696-449 Performance Tools & Free Scripts -------------------------------------------------------------- http://www.oriole.com, designed by Oracle DBAs for Oracle DBAs -------------------------------------------------------------- -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Stephane Faroult INET: sfaroult_at_oriole.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: MHately_at_etech-uk.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue Jul 10 2001 - 03:45:27 CDT
![]() |
![]() |