I m creating following proc to read external lob and strore in photo field of myimages table
structure of table myimages

id varchar2(3), photo blob

i have created a virtual directory from oracle which is mapped to physical directory

by command :-

create directory PICS as 'D:/images';
grant read on directory PICS to public;


the physical directory is having golf.gif file. its printing the length of the file
using getlength method. but loadfromfile method gives error msg as
value error invalid lob locator. if i place any other file like jpg also still it gives same error.

what could be the error....

create or replace procedure procblob as
lobd blob := empty_blob();
locator bfile := bfilename('PICS','golf.gif');
amt number;

begin
amt := dbms_lob.getlength(locator);
dbms_output.put_line('size of file is ' || amt);
dbms_lob.fileopen(locator,dbms_lob.file_readonly);
dbms_lob.loadfromfile(lobd,locator,amt);

insert into myimages values('2',null,lobd);
commit;
end;