Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL under OAS: sending blobs to browsers

Re: PL/SQL under OAS: sending blobs to browsers

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Tue, 12 Oct 1999 17:49:23 -0400
Message-ID: <easDOPwRSKfqNXBoDe1teNPT+=bp@4ax.com>


On Tue, 12 Oct 1999 20:30:11 GMT, fabuley_at_my-deja.com wrote:

>I'm trying to write a PL/SQL function running under the PL/SQL
>cartridge for OAS that will send BLOBs directly back to browsers. The
>ht package has support for uploading and downloading files but it seems
>absurdly limited in its functionality. Does anyone know how to do this?
>Thanks!

Yup.

procedure blob_to_browser is

    l_blob blob;
    l_mimetype varchar2(2000);
    l_raw raw(4069);
    l_amt number default 4000;
    l_off number default 1;

begin
  --
  --  Load your blob and mimetype into
  --  l_blob and l_mimetype
  --

  owa_util.mime_header( l_mimetype );
  dbms_lob.open( l_blob, dbms_lob.lob_readonly );   begin
    loop
      dbms_lob.read( l_blob, l_amt, l_off, l_raw );
      htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
      l_off := l_off+l_amt;
      l_amt := 4000;

    end loop;
  exception
    when no_data_found then
      null;
  end;
  dbms_lob.close( l_blob );
end;

hope this helps.

chris.

>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Tue Oct 12 1999 - 16:49:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US