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

Home -> Community -> Usenet -> c.d.o.tools -> BFILE & LOB questions?

BFILE & LOB questions?

From: Eddie <edawad_at_hotmail.com>
Date: 2000/05/04
Message-ID: <yRiQ4.857$vR1.94632@dfiatx1-snr1.gtei.net>#1/1

Using Oracle 8.0.5 Here is what I did:




CREATE TABLE item_images (

   inventory_item_id NUMBER NOT NULL,
   item_image BFILE default NULL    )
/

insert into item_images values (5112277, BFILENAME('BFILE_DIR', 'pin.gif'))
/

insert into item_images values (5112279, BFILENAME('BFILE_DIR', 'lip.gif'))
/

commit
/




Then I read the file into a buffer:


DECLARE
   Lob_loc BFILE;
   Buffer RAW(1024);
   Amount BINARY_INTEGER := 1024;
   Position INTEGER := 1;
BEGIN
   /* Select the LOB: */
   SELECT item_image
       INTO Lob_loc
     FROM test_item_images

   WHERE inventory_item_id = 5112277;
   /* Opening the BFILE: */
   DBMS_LOB.FILEOPEN (Lob_loc, DBMS_LOB.FILE_READONLY);    LOOP
      DBMS_LOB.READ (Lob_loc, Amount, Position, Buffer);
      Position := Position + Amount;

   END LOOP;
   /* Closing the BFILE: */
   DBMS_LOB.FILECLOSE (Lob_loc);
   EXCEPTION
   WHEN NO_DATA_FOUND THEN
      DBMS_OUTPUT.PUT_LINE('End of data'); END;


So far everything is fine, but ...
How can I retrieve the image file (which is now in the buffer variable) and display it on a web page or in any other gif image viewer? Your help is greatly appreciated.

Please reply to the newsgroup.
Eddie. Received on Thu May 04 2000 - 00:00:00 CDT

Original text of this message

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