Hi

I have the following procedure and I do not know I am encountering the errors even I have checked the error messages and set permission for the directory and file... please help!

----------------------

CREATE OR REPLACE PROCEDURE test_write
AS
v_output_file1 utl_file.file_type;
BEGIN

v_output_file1 := utl_file.fopen('/oracle/temp', 'my_test.txt', 'W');
FOR cursor_emp IN (SELECT * FROM EMP; )
LOOP
utl_file.put_line(v_output_file1, cursor_emp.username || ',' || cursor_emp.designation);
END LOOP;
utl_file.fclose_all;
END;
/

ERROR at line 1:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "SYS.UTL_FILE", line 98
ORA-06512: at "SYS.UTL_FILE", line 157
ORA-06512: at "SI.TEST_WRITE", line 8
ORA-06512: at line 1

-------------------------

By the way, how to write to the file with current date and time as the name of the file? Thanks!