Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Viewing BLOB jpgs and gifs.
I'm currently using the following snippet of code to pull BLOB jpgs
out of an oracle 8i database and presenting them to IE5.
This works great except that any jpg over 32767 bytes gets 'torn' when
it's sent to the browser. Anyone know how to fix this or even know
better way to do it?
PROCEDURE retr_img (id varchar2) as
Lob_field BLOB;
buffer RAW(32767);
offset BINARY_INTEGER:=1;
buffer_size NUMBER:=32767;
BEGIN
SELECT employee_image
INTO lob_field
FROM employee_table
WHERE employee_id=id;
LOOP
DBMS_LOB.READ(lob_field,buffer_size,offset,buffer);
htp.print(UTL_RAW.CAST_TO_VARCHAR2(buffer));
offset:=offset+buffer_size;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
null;
END retr_img;
The snippet is from an oracle tech note, so don't blame me ;)
Cheers,
Jason.
Received on Tue Nov 16 1999 - 13:42:01 CST
![]() |
![]() |