Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Viewing BLOB jpgs and gifs.
Hi Jason,
I'm an Oracle newbie, not experienced with PL/SQL,
so don't expect a right answer.
But what is if you try to increase the buffer from
32767 to what you need?
Could you tell me if it worked?
Where have you found the snippet exactly? (because I have the
same problem)
Martin
jason schrieb:
> 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 Wed Nov 17 1999 - 15:08:21 CST