RE: How to retrieve the pdf file stored as BLOB in Oracl e 9i

"Sreedevi" <[email protected]> Sun, 2 Mar 2003 09:27:08
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-894459-2003.03.02-09.10.18--gcdod-oracle#[email protected]>
> Look at AskTom.oracle:
http://asktom.oracle.com/pls/ask/f?
p=4950:8:52624307370274208::NO::F4950_P8_
DISPLAYID,F4950_P8_CRITERIA:232814159006,


Hi David,

Thanks for your reply. I looked at the example from AskTom.com. The 
example is very helpful. I tried changing the code as given in the sample 
at AskTom.com. I added owa_util.mime_header('application/pdf'); and 
htp.print(utl_raw.cast_to_varchar2(v_buffer));

But now I'm getting ORA-01403: no data found error, when the browser 
tries to open the PDF document in Adobe Acrobat.

v_buffer is RAW(32767);
htp.print(utl_raw.cast_to_varchar2(v_buffer)); is not working in Oracle9i 
Release 2.

I highly appreciate any help or suggestions for this problem. Thanks.

Here is my updated code:
-----------------------
set define off

create or replace package search_pdfServices as

  procedure showPDFDoc (p_id in numeric);

end;
/
show errors;

create or replace package body search_pdfServices as

  procedure showPDFDoc (p_id in numeric) is
    v_blob_selected   BLOB;
    v_read_amount     integer;
    v_read_offset     integer;
    v_buffer          RAW(32767);
   
   begin

     select text into v_blob_selected from search_pdf_table where tk = 
p_id;
     v_read_amount := 32767;
     v_read_offset := 1;
     owa_util.mime_header('application/pdf');
   begin
    loop
      dbms_lob.read(v_blob_selected,v_read_amount,v_read_offset,v_buffer);
      htp.print(utl_raw.cast_to_varchar2(v_buffer));	
      v_read_offset := v_read_offset + v_read_amount;
      v_read_amount := 32767;
    end loop;
   exception
   when no_data_found then
     -- null;
     wwerr_api_error_ui.show_html;	
   end;
 end showPDFDoc;

end;
/
show errors

set define on
---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to [email protected].