| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.server -> Re: UTL_FILE how to use utl_file.get_line
Hi,
Here is the example:--
SQL>
  1  DECLARE
  2    fileHandler UTL_FILE.FILE_TYPE;
  3  BEGIN
  4    fileHandler := UTL_FILE.FOPEN('c:\temp', 'manoj', 'W');
  5    UTL_FILE.PUTF(fileHandler, 'This is a test by MANOJ');
  6    UTL_FILE.FCLOSE(fileHandler);
  7* END;
SQL> /
PL/SQL procedure successfully completed.
2. Reading file
SQL> r
  1  DECLARE
  2    fileHandler UTL_FILE.FILE_TYPE;
  3    outputvar varchar2(100);
  4  BEGIN
  5    fileHandler := UTL_FILE.FOPEN('c:\temp', 'manoj', 'R');
  6    UTL_FILE.GET_LINE(fileHandler,outputvar);
  7    DBMS_OUTPUT.PUT_LINE(outputvar);
  8    UTL_FILE.FCLOSE(fileHandler);
  9* END;
This is a test by MANOJ
PL/SQL procedure successfully completed.
===============End========
Hope this helps,
Manoj Jain
Oracle DBA
In article <35214e76.2834009_at_news.iunet.it>,
  ntaibi_at_altavista.net (Nicola Taibi) wrote:
>
> I need urgent help with the UTL_FILE package.
> I succeed in opening and writing from sql*plus to a file ascii but
> cannot succeed in getting lines from it, because i receive an
> UTL.FILE.READ_ERROR exception in the UTL_FILE.GET_LINE procedure..
>
> Any help greatly appreciated,
> Nicola Salvatore Taibi
> Consultant
> ntaibi_at_altavista.net
> icq:6985895
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Wed Apr 01 1998 - 00:00:00 CST
|  |  |