Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Handling files in PL/SQL ???
A copy of this was sent to Grialet <grialet_at_dsi.cnrs.fr>
(if that email address didn't require changing)
On Wed, 24 Jun 1998 10:53:56 +0200, you wrote:
>Hello,
>
>I have a PL/SQL procedure that returns an HTML page (via Oracle
>WebServer and the package "htp"), i would like now to save that page
>into a file (on the server disk) instead of returning it to the browser.
>Do you know if it is possible, i.e. if i can create a file, write infos
>into it, and close it, all of that into my PL/SQL procedure ?
>If it is possible, can you give me the PL/SQL instructions to do this,
>or else where i can find more info about it ?
>
>Thanks, have a nice day.
>Stephane Grialet - grialet_at_dsi.cnrs.fr
You can do this in sqlplus without changing any of the existing code pretty easily. You might use a script like:
declare
nm owa.vc_arr;
vl owa.vc_arr;
begin
nm(1) := 'FOO';
vl(1) := 'BAR';
owa.init_cgi_env( 1, nm, vl );
end;
/
exec PROCEDURE_YOU_WANT_TO_SAVE_OUTPUT_OF
set heading off
set feedback off
set trimspool on
set linesize 255
set serveroutput on size 1000000
spool abc
exec owa_util.showpage
spool off
The first anonymous block sets up the 'cgi environment'. If your procedure relies on some settings in this environment, you would set it up here. This just shows you how to set up 1 environment variable named 'FOO' with a value BAR. You might set things like 'REMOTE_USER' or 'SERVER_PORT' or whatever values you might need.
Then you run the procedure.
Then you set a bunch of sqlplus formatting features off and create a spool file that has the output of the procedure. owa_util.showpage just takes the htp.htbuf array that htp writes to and dumps it to dbms_output so you can print it.
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Jun 24 1998 - 08:32:17 CDT
![]() |
![]() |