Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to execute Unix Command/program within a pl/sql block.

Re: How to execute Unix Command/program within a pl/sql block.

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Mon, 09 Jul 2001 15:06:01 -0700
Message-ID: <F001.00344E87.20010709152023@fatcity.com>

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).
Received on Mon Jul 09 2001 - 17:06:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US