We help IT Professionals succeed at work.

ORA-22285: non-existent directory or file for FILEOPEN operation

Medium Priority
46 Views
Last Modified: 2020-03-23
hi am geting the following error
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 805
ORA-06512: at "Iusername.LOAD_IMAGES", line 17
ORA-06512: at line 1

am using this script
create or replace procedure load_images
(
   p_id         in   number,
   p_file_name      in   varchar2
)
is
   v_bfile          bfile := bfilename( 'IMAGES' , p_file_name);
   v_blob          blob;
   v_src_offset  number := 1;
   v_dst_offset  number := 1;
begin

     insert into noc_image_liabrary (id, image_name, image_file)
        values (p_id, p_file_name, empty_blob())
        return images into v_blob;

   dbms_lob.fileopen(v_bfile, dbms_lob.file_readonly);
   dbms_lob.loadblobfromfile(v_blob, v_bfile, dbms_lob.getlength(v_bfile),v_src_offset,v_dst_offset);
   dbms_lob.close(v_bfile);
   commit;
end;
/

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
From your other question, I use the DIRECTORY you posted the DDL for:
CREATE OR REPLACE DIRECTORY IMAGES  as '/u01/images'

Make sure the 'oracle' user has read access to that folder.  Might need read and execute to actaully be able to list the files.  Cannot remember.