Unless I disrember, you can create a PL/SQL wrapper for your
Java stored procedure, and call OS commands from that.

Another way is to create an external library to do it for you.
This can also be in in Java, or in C.

Jared



                                                                                       
                        
                    MHately@etech-                                                     
                        
                    uk.com               To:     Multiple recipients of list ORACLE-L 
<[EMAIL PROTECTED]>   
                    Sent by:             cc:                                           
                        
                    [EMAIL PROTECTED]       Subject:     Re: How to execute Unix 
Command/program within a pl/sql  
                    om                    block.                                       
                        
                                                                                       
                        
                                                                                       
                        
                    07/10/01 02:37                                                     
                        
                    AM                                                                 
                        
                    Please respond                                                     
                        
                    to ORACLE-L                                                        
                        
                                                                                       
                        
                                                                                       
                        






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@ori|
|        |          ole.com>     |
|        |                       |
|        |          07/10/01     |
|        |          12:20 AM     |
|        |          Please       |
|        |          respond to   |
|        |          ORACLE-L     |
|        |                       |
|--------+----------------------->
  >------------------------------------------------|
  |                                                |
  |       To:     Multiple recipients of list      |
  |       ORACLE-L <[EMAIL PROTECTED]>          |
  |       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: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to