Re: Viewing BLOB jpgs and gifs.

From: jason <jason_at_seahorseNOSPAM.demon.co.uk>
Date: Thu, 18 Nov 1999 11:20:27 +0000
Message-ID: <huAzOCtwI6wK7Ft9GTMpCDO6OXES_at_4ax.com>


On Wed, 17 Nov 1999 22:08:21 +0100, Martin Kircher <mk_at_s.netic.de> wrote:

>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

32767 is the max value for a RAW type. There's something screwy going on with the offset, I dunno if an end-of-line or NULL is finding it's way in there somehow. If I put the values down to 2000 the tearing gets even worse!

Jason.

>
>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 Thu Nov 18 1999 - 12:20:27 CET

Original text of this message