Link to home
Create AccountLog in
Avatar of chalie001
chalie001

asked on

Error(14,16): PL/SQL: ORA-00904: "IMAGES": invalid identifier

Hi am geting this error after creating directory i did the following
SQL> connect sys /as sysdba
Enter password:
Connected.
SQL> CREATE DIRECTORY IMAGES AS '/u01/images';

Directory created.

SQL> commit;

Commit complete.

SQL> GRANT READ ON DIRECTORY IMAGES TO dba_users;

Grant succeeded.

SQL> commit;
User generated image
CREATE TABLE NOC_IMAGE_LIABRARY (id NUMBER,IMAGE_name VARCHAR2(50),image BLOB);

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, file_name, images)
        values (p_id, replace(p_file_name,'.png'), 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

Avatar of flow01
flow01
Flag of Netherlands image

Is it possible to succesfully execute (make XXX a real name) 
SELECT BFILENAME('IMAGES', 'XXX.png')
FROM dual;

If the answer is yes try granting the READ access to the owner of the procedure.
In a procedure or package explicit grants instead of grants by a role can be required

Open in new window


Open in new window

Avatar of chalie001
chalie001

ASKER

i did grant read
GRANT READ ON DIRECTORY IMAGES TO dba_users;
User generated image

Open in new window


Open in new window

ASKER CERTIFIED SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer