Oracle - UTL_FILE.fopen ORA-29280 invalid directory path

May 3, 2011

Too user UTL_FILE.fopen first create a directory in ORACLE
_
CREATE OR REPLACE DIRECTORY AS ‘/xxx/yyy/zzz’;_

Grant the permissions to it

GRANT WRITE ON DIRECTORY TO APPS_NPI;

Use the UTL_FILE.fopen in your PL/SQL block


_l_blob_len := DBMS_LOB.getlength (p_data);
l_out_file := UTL_FILE.fopen ('', file_name, ‘wb’, 32767);

WHILE l_pos < l_blob_len LOOP DBMS_LOB.READ (p_data, l_amount, l_pos, l_buffer); IF l_buffer IS NOT NULL THEN  UTL_FILE.put_raw (l_out_file, l_buffer, TRUE); END IF; l_pos := l_pos + l_amount; END LOOP; UTL_FILE.fclose (l_out_file);_