SQL> create directory log_test as 'c:\ken\sql\learning';
Directory created.
SQL> grant read,write on directory log_test to public;
Grant succeeded.
FileLogTest.sql
=================
CREATE OR REPLACE PROCEDURE fileLog
AS
fileHandle UTL_FILE.FILE_TYPE;
BEGIN
fileHandle := UTL_FILE.fopen('LOG_TEST', 'log.txt', 'a', 1024); -- Pay attention to the case for the directory here (UPPER CASE)
UTL_FILE.put_line(fileHandle, 'testing...', TRUE);
UTL_FILE.fclose(fileHandle);
END;
/
Reference
http://psoug.org/reference/utl_file.html