Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2009
    Posts
    9

    Unanswered: Help me!! Error in inserting images into table

    Hi all,
    here is the procedure I hope this is good
    but
    still i am getting same error
    i am sure pictures reside in photos directory as 'C:\myfiles'

    CAN ANY ONE TELL ME where i am doing wrong here PLEASE...............

    SQL> create or replace directory photos as 'C:\myfiles';

    Directory created.

    SQL> commit;

    Commit complete.

    SQL> grant read,write on directory photos to apps;

    Grant succeeded.

    SQL> commit;

    Commit complete.


    SQL> CREATE OR REPLACE procedure insert_img
    2 (p_catalogn number,p_photo varchar2)
    3 as
    4 f_photo bfile;
    5 b_photo blob;
    6 begin
    7 update sh_photo set picture=empty_blob()
    8 where catalogn=p_catalogn
    9 return picture into b_photo;
    10 f_photo := bfilename('photos',p_photo);
    11 dbms_lob.fileopen(f_photo,dbms_lob.file_readonly);
    12 dbms_lob.loadfromfile(b_photo,f_photo,dbms_lob.get length(f_photo));
    13 dbms_lob.fileclose(f_photo);
    14 commit;
    15 end insert_img;
    16
    17 /

    Procedure created.

    SQL> commit;

    Commit complete.

    SQL> execute insert_img(1,'Animallandscape.jpeg');
    BEGIN insert_img(1,'Animallandscape.jpeg'); END;

    *
    ERROR at line 1:
    ORA-22285: non-existent directory or file for FILEOPEN operation
    ORA-06512: at "SYS.DBMS_LOB", line 504
    ORA-06512: at "APPS.INSERT_IMG", line 11
    ORA-06512: at line 1

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Are you running this on the server?

    dbms_lob.fileXXX can only read files that are stored on the server where Oracle runs. I can not read files locally on your harddisk.

    Just noticed that you also posted in the wrong forum. This forum is for MySQL not Oracle.

  3. #3
    Join Date
    Jul 2009
    Posts
    9
    yes I am running on server
    but
    could you give me a clear idea
    where i am doing wrong

    regard
    pgudur

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by pgudur
    where i am doing wrong
    This is the wrong forum.
    Why do you duplicate your post in a forum which doesn't even deal with that DBMS?

  5. #5
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Quote Originally Posted by pgudur
    where i am doing wrong
    Considering I've already told you that this is an Oracle question then I'd guess that the answer to your above question is simply your career choice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •