Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Display blob (image) in plsql report

812686Aug 16 2011 — edited Aug 17 2011
Hi,

I have looked up quite a few forum posts on getting an image stored in a blob column to display in plsql report. I tried all of them with no success. I am using Oracle APEX 4.0.1 with 11g. My procedure is as below:
CREATE OR REPLACE procedure display_image(testID in varchar2) as
    v_mime  varchar2(255);
    v_length  number;
    v_file_name varchar2(2000);
    Lob_loc  BLOB;
BEGIN
    select document_mime, document_image, document_filename,dbms_lob.getlength(document_image)
        into v_mime,lob_loc,v_file_name,v_length
        from table_name
        where test_id = testID and flag is null;             
                    -- application/octect may launch a download window from windows
                    owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
 
                -- set the size so the browser knows how much to download
                htp.p('Content-length: ' || v_length);
                -- the filename will be used by the browser if the users does a save as
                htp.p('Content-Disposition: attachment; filename="' || v_file_name || '"');
        -- close the headers        
                owa_util.http_header_close;
        -- download the BLOB
        wpg_docload.download_file( Lob_loc );
end display_image;
In the plsql report, I use
htp.img('#OWNER#.display_image?testID='||:P5_TEST_ID); //page item that has the test ID
I have granted execute to both public and anonymous, still no change. When I run, I see a broken image in the report, on checking with inspect element, the url looks fine: http://server/pls/apex/display_image?testID=d6252.
Am I missing something? Any help is much appreciated!

Thanks,
Medha
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 14 2011
Added on Aug 16 2011
1 comment
1,058 views