Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: utl_file does not create file
In article <8lqdlu$a81$1_at_nnrp1.deja.com>,
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.
>
My first take on this is that PL/SQL is case sensitive, and, as such, the myfile declaration does not match the MYFILE assignment. Make MYFILE lower case and you should be fine.
-- David Fitzjarrell Oracle Certified DBA Sent via Deja.com http://www.deja.com/ Before you buy.Received on Thu Jul 27 2000 - 00:00:00 CDT
![]() |
![]() |