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;
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;