CREATE OR REPLACE DIRECTORY images AS 'C:\Images'; / DECLARE l_bfile BFILE; l_blob BLOB; BEGIN INSERT INTO HTMLDB_APPLICATION_FILES (name, blob_content) VALUES ( 'receipt1.gif', empty_blob()) RETURN blob_content INTO l_blob; l_bfile := BFILENAME('IMAGES', 'receipt1.gif'); 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); UPDATE EXPENSEITEM SET EXPRECIMG=(SELECT BLOB_CONTENT FROM HTMLDB_APPLICATION_FILES WHERE name ='receipt1.gif') , EXPRECID=(SELECT FROM HTMLDB_APPLICATION_FILES WHERE name ='receipt1.gif') WHERE EINO=1; COMMIT; END; /
ID