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

    Unanswered: Problem in inserting pictures into table


    Hi,
    I am inserting pictures into table

    when execute the procedure it says successfully procedure completed
    but i am unable to see pictures in table as +ve number in respective column.

    could any one tell me where i am going wrong here
    please........

    create or replace procedure insert_image
    (p_catalogn number,p_photo varchar2)
    as
    f_photo bfile;
    b_photo blob;
    begin
    update sh_photo set picture=empty_blob()
    where catalogn=p_catalogn
    return picture into b_photo;
    f_photo := bfilename('photos',p_photo);
    dbms_lob.fileopen(f_photo,dbms_lob.file_readonly);
    dbms_lob.loadfromfile(b_photo,f_photo,dbms_lob.get length(f_photo));
    dbms_lob.fileclose(f_photo);
    commit;
    exception
    when others then
    dbms_output.put_line('**** error ***** check your procedure');
    end;

    *************************************

    execute insert_image(1,'Animallandscape.jpeg');

    begin
    insert_image(1,'Animallandscape.jpeg');
    end;
    PL/SQL procedure successfully completed

    *************************************
    select catalogn,dbms_lob.getlength(picture) as photo_size from sh_photo;

    so in photo_size showing all zeros instead +Ve number as picture inserted into.

    please tell me where i am doing mistake....

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    You're in a MySQL forum but showing Oracle code.

Posting Permissions

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