drop table wiler_lob;
create table wilerlob (
id number (5) not null,
image blob not null
);
create or replace directory IMAGES as '/home/oracle';
create or replace procedure img_insert (inid number,infilename varchar2) as
v_f_lob bfile;
v_b_lob blob;
begin
insert into wilerlob values (inid,empty_blob()) return image into v_b_lob;
v_f_lob:= bfilename ('IMAGES', infilename);
dbms_lob.fileopen (v_f_lob, dbms_lob.file_readonly);
dbms_lob.loadfromfile (v_b_lob, v_f_lob,dbms_lob.getlength (v_f_lob));
dbms_lob.fileclose (v_f_lob);
commit;
end;
/
show err
exec img_insert(1,'expdat.dmp');
select length(image) from wilerlob where id=1;