Administrator
|
The error is coming from UTL_FILE and it complains with INVALID_FILEHANDLE.
1)Check the directory permission
2)Check if a file with the same name already exists in the relevant directory.
3)Check db alert log for errors
4)Check the directory / filesystem space
-- You can also use the following PLSQL for checking the utl file operations in this context and ensuring all is well - >
declare
v_FileHandle UTL_FILE.FILE_TYPE;
begin
v_FileHandle := UTL_FILE.FOPEN('<relevant_directory>','<same_name_as_the_reported_one','a');
UTL_FILE.PUT_LINE(v_FileHandle,to_char(sysdate,'DD-MON-YY HH24:MI:SS') || 'test....');
UTL_FILE.FFLUSH(v_FileHandle);
UTL_FILE.FCLOSE(v_FileHandle);
dbms_output.put_line('This worked with no exceptions');
exception
WHEN UTL_FILE.INVALID_OPERATION THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20001,'Error - INVALID OPERATION');
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20002,'Error - INVALID_FILEHANDLE');
WHEN UTL_FILE.WRITE_ERROR THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20003,'Error - WRITE_ERROR');
WHEN UTL_FILE.INVALID_PATH THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20004,'Error - INVALID_PATH');
WHEN OTHERS THEN
UTL_FILE.FCLOSE(v_FileHandle);
RAISE_APPLICATION_ERROR(-20004,'Error - OTHERS');
end;
/
Also noıte that ,he APPLPTMP environment variable points to a directory that does not exist on the database server. APPLPTMP is used by PL/SQL when temporary data storage is needed. If the environment variable points to a directory that does not exist then any PL/SQL process needing temporary storage will fail.
|