Yes. You can store Images in BLOB datatype in Oracle.
Using it is a bit tricky. You have to use DBMS_LOB package and know the syntax.
First Create an Oracle directory corresponding to the OS directory where your images are stored.
After creating the table with a column of BLOB datatype, you can initialize it by storing empty values (different from NULL values).Code:create directory root_dir as 'C:/My_Pictures';
Then you can load images with a procedure like this:
Wish you all the best.Code:CREATE OR REPLACE PROCEDURE loadLOB_proc IS Dest_loc BLOB; Src_loc BFILE := BFILENAME('ROOT_DIR', 'ocp_logo.gif'); Amount INTEGER := 4000;--this can be as per size of image BEGIN SELECT image INTO Dest_loc FROM imagetest WHERE ID = 1 FOR UPDATE; /* Opening the LOB is mandatory: */ DBMS_LOB.OPEN(Src_loc); /* Opening the LOB is optional: */ DBMS_LOB.OPEN(Dest_loc); DBMS_LOB.LOADFROMFILE(Dest_loc, Src_loc, Amount); /* Closing the LOB is mandatory if you have opened it: */ DBMS_LOB.CLOSE(Dest_loc); DBMS_LOB.CLOSE(Src_loc); COMMIT; END; / show errors




Reply With Quote