Hi there,
I am trying to store binary[] of data into a blob column and i having some difficulty.
I have following code to allow me to store binary image data, however my current implementation is reliant on physical image existing in a directory on the server:
DECLARE
l_dir VARCHAR2(10) := 'IMAGES';
l_file VARCHAR2(25) := 'test.jpg';
l_bfile BFILE;
l_blob BLOB;
BEGIN
INSERT INTO IMAGE_TBL (IMG_ID, IMG_DESC, IMG_DATA, IMG_EXT)
VALUES (IMAGE_TBL_SEQ.NEXTVAL, l_file, empty_blob(), '.jpg')
RETURN IMG_DATA INTO l_blob;
l_bfile := BFILENAME(l_dir, l_file);
DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
DBMS_LOB.loadfromfile(l_blob,
l_bfile,
DBMS_LOB.getlength(l_bfile));
DBMS_LOB.fileclose(l_bfile);
COMMIT;
END;
Now in the legacy application i'm working on, the incoming image data is base64encoded data which i then convert to binary[] array.
Can anyone please share with me the corresponding data type in Oracle that would allow me to store the binary[] data into the BLOB column?
Any code samples would be appreciated as well.
What I have tried:
I have tried the above code and researched Oracle docs but i couldn't find anything relating to storing binary data into a blob type column or storing base64encoded image to a blob type column.