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

Home -> Community -> Usenet -> c.d.o.misc -> Re: HELP w/ PL/SQL writing to a flat file.

Re: HELP w/ PL/SQL writing to a flat file.

From: Ian Cary <cary_at_gatwick.geco-prakla.slb.com>
Date: 1997/11/12
Message-ID: <3469A7F2.95701D58@gatwick.geco-prakla.slb.com>#1/1

djdrew wrote:

> I've gone through the documentation in the oracle programmer's reference
> and the O'Reilly books, but I can't seem to get PL/SQL to write to a
> flat file. Can anyone give me actual code that I may be able to use to
> perform this procedure?

You have two alternaternatives.

  1. use dbms_output;

i.e.

    set serveroutput on
    spool file name

    begin

            dbms_output.put_line('This will output to a flat file');     end;

    A limitation with this method is can be the size of the output buffer.

2) use utl_file;

i.e.

     declare
         filhand utl_file.file_type;
     begin
         filhand := utl_file.fopen('dirname','filename','w');
        utl_file.put_line(filhand,'This will output to a flat file');
     end;

    For this to work a line;

    utl_file_dir=dirname

    must have been place within your init.ora file.

Hope this helps,

Ian Received on Wed Nov 12 1997 - 00:00:00 CST

Original text of this message

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