May 26 2014

ORACLE如何将本地文件以Bolb/CLOB形式存到数据库中 .

create or replace directory images as ‘C:\images’;
declare
l_bfile bfile;
l_blob blob;
begin
insert into exdata_source(nm_center_seq_id,st_source,st_version,bl_data,st_key) values(19940808,’0800000000′,’2′,empty_blob(),’P21456789test.xml’)
return bl_data into l_blob;
l_bfile:=bfilename(‘IMAGES’,’P21456789test.xml’);
dbms_lob.open(l_bfile,dbms_lob.file_readonly);
dbms_lob.loadfromfile(l_blob,l_bfile,dbms_lob.getlength(l_bfile));
dbms_lob.close(l_bfile);
commit;
end;
select * from exdata_source where nm_center_seq_id=19940808

 

 

 

 

dbms_lob包很强大  还有to_blob() 如果你只是一个文本 这样子就可以了



Copyright 2019. All rights reserved.

Posted 2014年5月26日 by ucjmh in category "oracle

Leave a Reply

Your email address will not be published. Required fields are marked *