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

Home -> Community -> Usenet -> c.d.o.server -> Re: UTL_FILE package. Need Help!

Re: UTL_FILE package. Need Help!

From: Suresh Bhat <suresh.bhat_at_mitchell-energy.com>
Date: Tue, 13 Jul 1999 20:35:17 GMT
Message-ID: <01becd7f$d6583c00$a504fa80@mndnet>


Hi -

I think if you use put for the first 3 writes rather than putf, and close only after the 4th line is written with putf, your problem will be solved.

Suresh Bhat
Oracleguru
www.oracleguru.net
oracleguru_at_mailcity.com

Art Vandeley <mannyotero_at_yahoo.com> wrote in article <7mfl9e$n0p$1_at_ash.prod.itd.earthlink.net>...
> Hi,
>
> I have written a procedure using the UTL_FILE package to write data from
a
> table to a text file. Unfortunately, each row of the data I am writting
is
> pretty long, more than the allowed 1023 buffer.
>
> I have tried using UTL_FILE.FFLUSH in such a way that the procedure would
> write part of the row then flush the buffer and then write the last part
of
> the row before continuing to the next row. This is not working.
>
> The only way I have been able to get the program to work is with the code
> below, where 'buffervariable1-4' are the four different variables that
make
> up the entire row, each of them contains close to 1000 chars.
>
> By doing it the way I have it below the file is created but after each
CLOSE
> command the program inserts a NEWLINE so that my one row of data is
actually
> on fours different rows.
>
> -------------- write data to out file --------------
>
> begin
>
> UTL_FILE.PUTF(filehandle, buffervariable1);
> UTL_FILE.FCLOSE(filehandle);
> filehandle := UTL_FILE.FOPEN('c:\utlfiles','svcordrs.txt','a');
>
>
> UTL_FILE.PUTF(filehandle, buffervariable2);
> UTL_FILE.FCLOSE(filehandle);
> filehandle := UTL_FILE.FOPEN('c:\utlfiles','svcordrs.txt','a');
>
>
> UTL_FILE.PUTF(filehandle, buffervariable3);
> UTL_FILE.FCLOSE(filehandle);
> filehandle := UTL_FILE.FOPEN('c:\utlfiles','svcordrs.txt','a');
>
>
> UTL_FILE.PUTF(filehandle, buffervariable4);
> UTL_FILE.FCLOSE(filehandle);
> filehandle := UTL_FILE.FOPEN('c:\utlfiles','svcordrs.txt','a');
>
>
> EXCEPTION
>
> WHEN OTHERS THEN
>
> DBMS_OUTPUT.PUT_LINE('ERROR ' || to_char(SQLCODE) || ' ' ||
> SQLERRM);
> null;
>
> end;
>
> -----------------------------------------------------
>
>
> Now, I have tried it this way but it hasn't worked:
>
>
> -------------- write data to out file --------------
>
> begin
>
> UTL_FILE.PUTF(filehandle, buffervariable1);
> UTL_FILE.FFLUSH(filehandle);
>
> UTL_FILE.PUTF(filehandle, buffervariable2);
> UTL_FILE.FFLUSH(filehandle);
>
> UTL_FILE.PUTF(filehandle, buffervariable3);
> UTL_FILE.FFLUSH(filehandle);
>
> UTL_FILE.PUTF(filehandle, buffervariable4);
> UTL_FILE.FFLUSH(filehandle);
>
> UTL_FILE.NEW_LINE(filehandle,1);
>
>
> EXCEPTION
>
> WHEN OTHERS THEN
>
> DBMS_OUTPUT.PUT_LINE('ERROR ' || to_char(SQLCODE) || ' ' ||
> SQLERRM);
> null;
>
> end;
>
> -----------------------------------------------------
>
>
> PLEASE HELP!!!!!!!
>
> Thanks,
> Manny Otero
> Developer / DBA
> SLi Lighting Solutions
> manny.otero_at_bigfoot.com
>
>
>
>
>
>
>
Received on Tue Jul 13 1999 - 15:35:17 CDT

Original text of this message

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