plsql插入圖片

maojinyu發表於2011-01-26

create or replace directory gp as 'c:gp';

insert into pict values('maoyaxi',empty_blob());

declare
dest_lob blob;
src_lob bfile:=bfilename('GP','maoyaxi.jpg');
amount integer:=dbms_lob.getlength(src_lob);
begin
select pict into dest_lob from pict
where pictname='maoyaxi' for update;
dbms_lob.fileopen(src_lob);
dbms_lob.loadfromfile(dest_lob,src_lob,amount);
dbms_lob.fileclose(Src_lob);
commit;
end;

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9907339/viewspace-1045207/,如需轉載,請註明出處,否則將追究法律責任。

相關文章