| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Displaying Images stored in a BLOB Datatype Field
Here is the sample pl/sql procedure that allows retrieval of image and display directly to a HTML page in Oracle 8i.
/*-----------------------------------------------------*/procedure DisplayImage is
vblob blob;
buffer raw(32000);
buffer_size integer :=32000;
offset integer :=1;
length number;
begin
/* If saved file type for JPEG, else if gif use 'image/gif' */ owa_util.mime_header('image/jpg');
select COLUMN_NAME into vblob from TBLDUMMY;
length := dbms_lob.getlength(vblob);
while offset < length loop
dbms_lob.read(vblob, buffer_size, offset, buffer);
htp.p(utl_raw.cast_to_varchar2(buffer));
offset:=offset + buffer_size;
exception
when others then
htp.p(sqlerrm);
end;
Hari Polu
hari_at_claygency.com
"Sean Kubovcik" <seank_at_centurytel.net> wrote in message
news:VlGG6.4034$uU6.805639_at_feed.centurytel.net...
> I am able to store images into a blob datatype field, but now I am trying
to
> display the contents to verify that the image loaded properly. Is there a
> quick and dirty way to display the blob image via SQL*Plus or PL/SQL?
> Thanks in advance for you assistance,
> Sean
>
>
Received on Sat Apr 28 2001 - 23:19:07 CDT
![]() |
![]() |