Re: PL/SQL and output
Date: 1998/03/20
Message-ID: <01bd53fc$371f3ce0$86c2657e_at_mkrivak>#1/1
See Application Developer's Guide
Use package UTL_FILE (you have to run version 7.3).
Append to init.ora:
UTL_FILE_DIR=*
Try something like this:
create or replace procedure p is
spfile UTL_FILE.FILE_TYPE;
err_num VARcHAR2(10);
err_msg VARcHAR2(100);
begin
spfile:=UTL_FILE.FOPEN('c:\plsql\spool\','p.log','a');
UTL_FILE.PUT_LINE(spfile,'I want to write this to file p.log');
UTL_FILE.FcLOSE(spfile);
EXcEPTION
WHEN OTHERS THEN
err_num := TO_cHAR(SQLCODE);
err_msg := SUBSTR(SQLERRM, 1, 100);
DBMS_OUTPUT.PUT_LINE(err_num||' '|| err_msg);
END;
/
Good luck,
Martin
Zoran <zoranm_at_echo-on.net> wrote in article
<6eskob$rs3$1_at_neuromancer.echo-on.net>...
> This is definitely possible. But since I'm -not- currently at work, I
can't
> send a sample.
>
> I do remember that there's a init parm in the init.ora (oracle startup
> initialization file) that must be set to some directory, before you can
use
> of PUT_LINE (or is some other function, argh, I can't remember the exact
> details without having my code in front of me).
>
> I read about all this in the Oracle Application Developers Guide. If I
> remember correctly, there's a whole chapter (or appendix) on Oracle
supplied
> packages, one of which is DBMS_OUTPUT, or is it DBMS_FILE - the one that
> lets you read/write to flat files on disk.
>
> Hope this helps.
>
> Zoran.
>
> Kevin Bass wrote in message <6esfae$rr5_at_camel21.mindspring.com>...
> >I have attempted to print output from a PL/SQL program into a file but
> >received no results. Are there any other ways to print information
(data)
> >into a file without using DBMS_OUTPUT.PUT_LINE or DBMS_OUTPUT.PUT? If
so,
> >please send sample code.
> >
> >Kevin
> >
> >
>
>
Received on Fri Mar 20 1998 - 00:00:00 CET