-
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;
-
Thanx
Sam
Life is a journey, not a destination!
-
Don't know if you've fixed this yet but you need to lock the destination LOB prior to calling LoadFromFile.
--initialiaze the LOB column
insert into myimages values('2',empty_blob());
--lock the destination LOB
select photo
into lobd
from myimages
where id = '2'
for update;
Hope this helps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|