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 -> package UTL_FILE

package UTL_FILE

From: Corrado Fantuz <corrado.fantuz_at_snam.eni.it>
Date: Tue, 05 Jan 1999 09:17:42 +0100
Message-ID: <3691CAA5.D34F3848@snam.eni.it>


Hi,
i am running Win95 and working with Oracle7 Server Release 7.3.4.0.0. I'm trying to read a file TEXT with package UTL_FILE:


/*---------------------------------------------------------------------------------------

        prova lettura file
---------------------------------------------------------------------------------------*/

CREATE OR REPLACE PROCEDURE prova
 ( ppath in varchar2,
   pfile in varchar2)

        IS

        num_err                         number;

        mfile                  UTL_FILE.FILE_TYPE;
        mriga                  varchar2(80);

 --ROUTINE
 procedure chiudi as
 begin

    IF UTL_FILE.is_open(mfile) THEN

       UTL_FILE.fclose(mfile);
    END IF;
 end;

BEGIN
 delete from ts40_log_err;
 commit;

 mfile:=UTL_FILE.fopen(ppath,pfile,'r');

 UTL_FILE.get_line(mfile,mriga);

 INSERT INTO ts40_log_err
  VALUES ( 0, 0, 'letta : ' || mriga);

 chiudi;

EXCEPTION
   WHEN UTL_FILE.INVALID_PATH THEN

        chiudi;
        INSERT INTO ts40_log_err
        VALUES ( 0, 0, 'Prova errore : path errato ' || ppath || ' ' ||
pfile );
        COMMIT;

   WHEN UTL_FILE.INVALID_MODE THEN
         chiudi;
         INSERT INTO ts40_log_err
        VALUES ( 0, 0, 'Prova errore : modalità errata' );
        COMMIT;

   WHEN UTL_FILE.INVALID_OPERATION THEN
         chiudi;
         INSERT INTO ts40_log_err
        VALUES ( 0, 0, 'Prova errore : operazione errata' );
        COMMIT;

   WHEN OTHERS THEN
         chiudi;
        num_err := SQLCODE;
        INSERT INTO ts40_log_err
        VALUES ( 0, 0, 'Prova errore : ' || num_err);
        COMMIT;

END;
/


I call this procedure with command "exec prova('T:','DATAINIZ.xxx');" but i have a "UTL_FILE.INVALID_PATH" error.

Thanks in advance.
Flavio

: Received on Tue Jan 05 1999 - 02:17:42 CST

Original text of this message

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