Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> PL/SQL and writing files
I am having trouble writing a log file to a server using PL/SQL. The following is my code for my stored procedure:
IS
file_handle UTL_FILE.FILE_TYPE;
time_stamp varchar2(20);
BEGIN
DBMS_OUTPUT.PUT_LINE('About to open log file...');
file_handle := UTL_FILE.FOPEN('/log/', 'SPErrors.log', 'A');
SELECT TO_CHAR(sysdate, 'MMDDYY HH:MI')
INTO time_stamp
FROM dual;
UTL_FILE.PUT_LINE(file_handle, time_stamp || ' [Procedure: write_log]
--> This is a test to log info to a file.');
UTL_FILE.NEW_LINE(file_handle);
DBMS_OUTPUT.PUT_LINE('Message logged...');
UTL_FILE.FCLOSE(file_handle);
DBMS_OUTPUT.PUT_LINE('Closing LogFile...');
EXCEPTION
WHEN UTL_FILE.INVALID_OPERATION THEN
DBMS_OUTPUT.PUT_LINE('Error with UTL_FILE');
UTL_FILE.FCLOSE(file_handle);
END;
Everytime I run it in SQL-PLUS, I get the following error:
ERROR at line 1:
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 "WWW_USER.WRITE_LOG", line 8 ORA-06512: at line 1
What does this mean, and how can I fix this?
Please respond via email because I cannot check the newsgroup too many times during the day.
-- ************************************ Bryan J. Gentile Consultant Business Data Services, Inc. Glastonbury, CT 06033 Phone: (860)633-3693 (ext. 3025) Vmail: (ext. 6030) ************************************Received on Tue Oct 28 1997 - 00:00:00 CST