BFILE & LOB Question?
From: Eddie <edawad_at_hotmail.com>
Date: 2000/05/04
Message-ID: <VSiQ4.867$vR1.94833_at_dfiatx1-snr1.gtei.net>#1/1
CREATE TABLE item_images (
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
WHERE inventory_item_id = 5112277;
/* Opening the BFILE: */
DBMS_LOB.FILEOPEN (Lob_loc, DBMS_LOB.FILE_READONLY); LOOP
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.
Date: 2000/05/04
Message-ID: <VSiQ4.867$vR1.94833_at_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 CEST