Re: PLSQL - Escaping to host?

From: Fernando Luna <fern_at_aa.net>
Date: 1996/05/05
Message-ID: <4mhrc0$k2c_at_Holly.aa.net>#1/1


Simon <jb85_at_dial.pipex.com> wrote:

>This is a multi-part message in MIME format.
 

>---------------------------------290813275032060
>Content-Transfer-Encoding: 7bit
>Content-Type: text/plain; charset=us-ascii

>--
>Simon Holt - Oracle System designer/DBA
> ** My opinions do not necessarily reflect those of my employer **
>Britannia Zinc Ltd. Tel (+44) 0117 982 3646

>---------------------------------290813275032060
>Content-Transfer-Encoding: 7bit
>Content-Type: text/plain
 

>1234567890123456789012345678901234567890123456789012345678901234567890
>Could anyone help me out here please?
 

>I'm trying to write a PL/SQL package which will involve a couple of
>operating system commands; if I were writing this in SQL*Plus, I'd
>use the HOST command, but I'm not sure if the equivalent exists in
>PL/SQL.
 
>What I want to achieve is the following:
 

>a: Output a line to a file (in order to build up a print file)
>b: Send a file to a printer
 

>As an example, what I would like to do in the case of b: is something
>like this:
 

> OPEN c_printer /* Cursor to printer names table */
> LOOP
> FETCH c_printer into destination;
> HOST ("np -q " + destination + " filename");
> EXIT WHEN c_printer%NOTFOUND;
> END LOOP;
 
>Would this work? If not, is there a simple way round it?
 

>Many thanks in advance!
 

>Details: Designer 2000 v1.2
> HP-UX 10.01 GBR
> Oracle 7.1.4
 

>---------------------------------290813275032060--

Hi Simon:

The short answer to your question is: no... PL/SQL does not have the equivalent of the Forms built-in "Host" although, depending on the release version of PL/SQL that you have (2.3 and above, if I'm not mistaken) there are some DBMS_UTIL procedures that you can use that can make calls to the operating system. I do know for a fact that DBMS_UTIL does provide some file manipulation. I don't know specifically that it will run an operating system command for you...

If, judging from the example you provided, all you want to do is retrieve records and spool them out to a file, you wouldn't need PL/SQL to do that. I'm sure that your problem is a little more involved, though. Perhaps you could do it from SQL*Forms, where the call to "Host" is valid? Received on Sun May 05 1996 - 00:00:00 CEST

Original text of this message