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 does not create file

Re: utl_file does not create file

From: Frank Hubeny <fhubeny_at_ntsource.com>
Date: 2000/07/28
Message-ID: <3981CFA0.1413FDF1@ntsource.com>#1/1

I tried your code on an NT4 test machine running 8.1.6 and got the expected file, annScript.sql, in the C:\Temp directory. This makes me wonder why you do not see the file. Some possible reasons:

(1) You may need to refresh the directory listing using F5. Also, if you uncomment the utl_file.fclose(myfile) line the length of the file should display a length besides 0.

(2) You mentioned that you set the utl_file_dir parameter in the init.ora file. I assume that you also shutdown and started the database after modifying the inti.ora so that this parameter becomes active.

(3) If you are on a different machine than your database, the file will be created in the C:\Temp directory of the machine that the database is on, not the client machine.

Frank Hubeny

aowens2325_at_my-deja.com wrote:

> I cannot get the utl_file utility to create and write to the specified
> file. I am using the following code:
>
> DECLARE
>
> myfile UTL_FILE.FILE_TYPE;
>
> BEGIN
> MYFILE:=UTL_FILE.FOPEN('C:\Temp','annScript.SQL','w');
> UTL_FILE.PUT_LINE(myfile,')');
> -- if (utl_file.is_open(MYFILE)) then
> -- dbms_output.put_line('>>> File opened');
> --else
> -- dbms_output.put_line('>>> File not open');
> -- end if;
>
> --UTL_FILE.FCLOSE(myfile);
> EXCEPTION
> when utl_file.invalid_path then
> dbms_output.put_line('>>> Invalid path');
> when utl_file.invalid_filehandle then
> dbms_output.put_line('>>> Invalid file handle');
> when utl_file.invalid_mode then
> dbms_output.put_line('>>> Invalid mode');
> when utl_file.invalid_operation then
> dbms_output.put_line('>>> Invalid operation');
> when utl_file.write_error then
> dbms_output.put_line('>>> Write error');
> when utl_file.read_error then
> dbms_output.put_line('>>> Read error');
> when utl_file.internal_error then
> dbms_output.put_line('>>> Internal error');
> WHEN OTHERS THEN
> DBMS_OUTPUT.PUT_LINE(SQLERRM);
> DBMS_OUTPUT.PUT_LINE(SQLCODE);
> END;
> I have added the file location C:\Temp to the utl_file_dir parameter of
> the Init.ora file. I get no exceptions but there is no file.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Fri Jul 28 2000 - 00:00:00 CDT

Original text of this message

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