| UTL_FILE Invalid Operation [message #41910] |
Mon, 10 February 2003 14:23  |
victor rodriguez
Messages: 6 Registered: December 2002
|
Junior Member |
|
|
I get the following error when attempting to use the UTL_FILE package as show below:
SQL> exec test
begin test; end;
*
ERROR at line 1:
ORA-20051: Invalid operation.
ORA-06512: at "HWMSDD1.TEST", line 48
ORA-06512: at line 1
CREATE OR REPLACE PROCEDURE Test
IS
p_FileDir VARCHAR2(25) := '/cpl/sfo';
p_FileName VARCHAR2(25) := 'partNoConversion';
v_FileHandle UTL_FILE.FILE_TYPE;
v_NewLine VARCHAR2(100);
v_Work2000PartNo VARCHAR2(24);
v_passPortPartNo VARCHAR2(24);
v_Comma_Position NUMBER;
BEGIN
v_FileHandle := UTL_FILE.FOPEN(p_FileDir, p_FileName, 'r');
LOOP
BEGIN
UTL_FILE.GET_LINE(v_FileHandle, v_NewLine);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('We got an error.');
END;
DBMS_OUTPUT.PUT_LINE(v_NewLine);
END LOOP;
EXCEPTION
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20052, 'Invalid file handle.');
WHEN UTL_FILE.READ_ERROR THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20053, 'Read error.');
WHEN UTL_FILE.INVALID_PATH THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20054, 'Invalid path.');
WHEN UTL_FILE.INVALID_MODE THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20055, 'Invalid mode.');
WHEN UTL_FILE.INTERNAL_ERROR THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20056, 'Internal error.');
WHEN VALUE_ERROR THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20057, 'Value error.');
WHEN UTL_FILE.INVALID_OPERATION THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20051, 'Invalid operation.');
WHEN others THEN
dbms_output.put_line('Failed');
RAISE;
END;
My database UTL_FILE DIR parameter is set to *.
Has anybody got an idea why I get this error? Thanks.
|
|
|
|
| Re: UTL_FILE Invalid Operation [message #41911 is a reply to message #41910] |
Mon, 10 February 2003 14:55  |
victor rodriguez
Messages: 6 Registered: December 2002
|
Junior Member |
|
|
Working with my dba/unix admin, we determined that it was due to the fact that the oracle account did not have access to the directory I was trying to use. I switched to the /tmp directory (after having moved my file) and reran the procedure. It worked.
Well that is a temporary solution. We are going to give the proper rights to the oracle account on that directory.
Thanks.
|
|
|
|