UTL_FILE Problem? [message #369861] |
Fri, 27 October 2000 13:35 |
Suresh.N
Messages: 41 Registered: March 2000
|
Member |
|
|
Hi!
I am getting the Invalid_operation Exception while
using UTL_FILE Package..
This is my test proc:
CREATE OR REPLACE PROCEDURE ReadFile
IS
File_handle utl_file.file_type;
Current_Record varchar2(2000);
Buffer_record varchar2(2000);
BEGIN
File_handle := utl_file.Fopen('C:\PLXML\DBDOM','Testfile.txt','r');
DBMS_OUTPUT.PUT_LINE('before buffer_record');
Utl_file.Get_line(file_handle,buffer_Record);
DBMS_OUTPUT.PUT_LINE(buffer_record);
UTL_FILE.FCLOSE(file_handle);
Exception
When no_Data_found then
Dbms_output.put_line('No Data Found');
when UTL_FILE.INVALID_PATH then
Dbms_output.put_line('invalid_path');
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 OTHERS THEN
Dbms_output.put_line(sqlerrm);
END;
Give me the solution. Very irgent.
Thanks and Regards
Suresh
|
|
|
Re: UTL_FILE Problem? [message #369881 is a reply to message #369861] |
Wed, 01 November 2000 09:55 |
Austin Grey
Messages: 1 Registered: November 2000
|
Junior Member |
|
|
Suresh,
You have not said what is the hardware platform of your Oracle server.
If the platform is Windows NT then your file location of 'C:\PLXML\DBDOM' will be O.K . If your platform is UNIX you will have to use a forward slash '/' to separate you directories.
Also, in order to use UTL_FILE, an access path must initially be specified. This is done by setting the UTL_FILE_DIR parameter in the Oracle INIT.ORA file, to tell Oracle which directories you are reading from and writing to, eg:
A single directory:
UTL_FILE_DIR=C:\PLXML\DBDOM
Multiple Directories:
UTL_FILE_DIR=C:\PLXML\DBDOM
Any directory that the Oracle owner has read or write permissions:
UTL_FILE_DIR=c:\???\
Good luck
|
|
|