ballpenxp

博客园 首页 新随笔 联系 订阅 管理
create or replace directory utllobdir as 'c:\xxx'; --你的BLOB文件所在位置。
create table bfile_tab (bfile_column BFILE);
create table t (blob_column BLOB);
----------------------------------------
declare
   a_blob  BLOB;
   a_bfile BFILE := BFILENAME('UTLLOBDIR','BLOB文件名');
begin
   insert into bfile_tab values (a_bfile)
     returning bfile_column into a_bfile;
   insert into t values (empty_blob())
     returning blob_column into a_blob;
   dbms_lob.fileopen(a_bfile);
   dbms_lob.loadfromfile(a_blob, a_bfile, dbms_lob.getlength(a_bfile));
   dbms_lob.fileclose(a_bfile);
   commit;
end;

 

posted on 2007-09-12 10:16  ballpenxp  阅读(3431)  评论(0编辑  收藏  举报