UTL_FILE [message #469] |
Thu, 14 February 2002 11:34  |
Roy Jeans
Messages: 2 Registered: February 2002
|
Junior Member |
|
|
I have just started experimenting with UTL_FILE.
When I try to execute the following test statement :-
DECLARE
in_data UTL_FILE.FILE_TYPE;
BEGIN
in_data := UTL_FILE.FOPEN ('c:a','text.txt','W');
UTL_FILE.PUT_LINE ('This is a test');
UTL_FILE.FCLOSE (in_data);
END;
I get the following error message :-
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "SYS.UTL_FILE", line 82
ORA-06512: at "SYS.UTL_FILE", line 120
ORA-06512: at line 4
Can anyone explain what I'm doing wrong ?
I have granted access to the package and have set
the UTL_FILE_DIR parameter in my initorcl.ora file.
Thanks in advance.
|
|
|
|
Re: UTL_FILE [message #485 is a reply to message #469] |
Fri, 15 February 2002 00:02  |
pratap kumar tripathy
Messages: 660 Registered: January 2002
|
Senior Member |
|
|
Hi try this code.which will tell u what exactly what is going wrong
DECLARE
in_data UTL_FILE.FILE_TYPE;
BEGIN
in_data := UTL_FILE.FOPEN ('c:temp','text.txt','W');
UTL_FILE.PUT_LINE (in_data,'This is a test');
UTL_FILE.FCLOSE (in_data);
exception
when utl_file.invalid_operation then
UTL_FILE.FCLOSE_ALL;
raise_application_error(-20051, 'FILE COULD NOT OPENED');
when utl_file.invalid_path then
UTL_FILE.FCLOSE_ALL;
raise_application_error(-20100, 'RESET: INVALID PATH.');
when utl_file.invalid_mode then
UTL_FILE.FCLOSE_ALL;
raise_application_error(-20101, 'RESET: INVALID MODE.');
when utl_file.read_error then
UTL_FILE.FCLOSE_ALL;
raise_application_error(-20053, 'RESET: READ ERROR.');
when utl_file.invalid_filehandle then
UTL_FILE.FCLOSE_ALL;
raise_application_error(-20052, 'RESET: INVALID FILE HANDLE.');
when others then
UTL_FILE.FCLOSE_ALL;
raise;
END;
/
|
|
|