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

    Unanswered: error in inserting picture into table

    Here is the code:

    though i created directory as photos
    and i placed all images in photos directory
    but it is keep giving error as non-existent
    so could any help me please.........



    1 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* end insert_img;
    SQL> /

    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
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >though i created directory as photos
    so you say
    >and i placed all images in photos directory
    so you say
    >but it is keep giving error as non-existent
    appears so
    >so could any help me please.........
    Your "photos" directory can not be located by Oracle.
    I suggest you provide Oracle complete pathname & not relative pathname.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jul 2009
    Posts
    9
    you mean is this path?

    create table sh_photo(catalogn number
    ,picture blob
    ,foreign key(catalogn) references photo(catalogn)
    );

    Directory path:
    create or replace directory photos as 'c:\myfiles';

    please help me, how to resolve this error..........

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >create or replace directory photos as 'c:\myfiles';
    >please help me, how to resolve this error..........
    Have you ever successfully used CREATE OR REPLACE DIRECTORY before?

    I suggest you consider the impact of case sensitivity (or lack thereof) on what you are attempting to do.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Jul 2009
    Posts
    9
    yes
    I used successfully

    could you please let me know clearly about this
    where i am doing wrong
    do i need to grant write privileges for this directory to insert the pricture into the table of schema(apps) i am working on now.

    if so could you please help me to insert the picture into table.
    I appriciate if any ..........

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >do i need to grant write privileges for this directory
    I have NO idea about privs.
    I don't know which user is running procedure.
    I don't know which user owns the folder.
    I don't know what permissions exist.
    Do yourself a favor.
    Open a command window.
    cd C:
    dir

    CUT the results from DIR above & paste results back here.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  7. #7
    Join Date
    Jul 2009
    Posts
    9
    Hi,
    If you dont know why you replied me sir, I am beginner in this field I have to learn a lot.
    If you have answer for this try to help me
    otherwise dont waste my time and yours, Good Luck.

    Regards
    pgudur

  8. #8
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    ENJOY your mystery.

    I suggest you consider the impact of case sensitivity (or lack thereof) on what you are attempting to do.

    'abc' not equal 'ABC'
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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