I am trying to select bytes from oracle database and convert them to image file. When I wrote the oracle procedure it stops in UTL_FILE.fopen and returns a ORA-29280 error. Oracle community says that this error is caused because OS level user may has no permission to write to a folder, or we should use upper_cases. But for suggestion 1, I tried to access the same folder using .Net and image file was created successfully, for suggestion 2 I tried using upper cases but I am still facing the same error. What could be the problem? Why I can create file from .Net but not from oracle? Below is my code:
CREATE OR REPLACE PROCEDURE BLOB_UPDATE (file_name in varchar) IS
file_ref UTL_FILE.file_type;
raw_max_size constant number := 32767;
begin
file_ref := UTL_FILE.fopen('C:\LOB', file_name, 'WB', raw_max_size);
-- Here it stops working ! --
....
utl_file.fclose(file_ref);
END BLOB_UPDATE;
Please execute on your DB:
create or replace directory DIR as 'C:\LOB'
grant read, write on directory DIR to your_user
And then access directory in your procedure by:
file_ref := UTL_FILE.fopen('DIR', file_name, 'WB', raw_max_size);