create or replace procedure load_blob(v_bdm in varchar2,v_blob_field in varchar2,
v_where in varchar2,v_filename in varchar2) is
blob_loc blob;
bfile_loc Bfile;
amount int;
v_sql varchar2(300);
begin
v_sql:= 'select '||v_blob_field|| ' from '||v_bdm|| ' where '||v_where|| ' for update ';
execute immediate v_sql into blob_loc ;
--create or ....DOWNFILE
bfile_loc:=bfilename( 'DOWNFILE ',v_filename);
dbms_lob.fileopen(bfile_loc,dbms_lob.file_readonly);
amount:=dbms_lob.getlength(bfile_loc);
dbms_lob.loadfromfile(blob_loc, bfile_loc,amount);
v_sql:= 'UPDATE '||v_bdm|| ' SET '||v_blob_field|| ' = '||blob_loc|| ' WHERE '||v_where;
--PLS-00306:调用 '|| '时参数个数或类型错误
execute immediate v_sql;
dbms_lob.fileclose(bfile_loc);
end load_blob;
执行时出的上面注释的问题,请问下blob字段可以这样更新吗.上面写的那个v_sql的语句中 "|| "不多也不少吧,为什么报这种错呢?
------解决方案--------------------
顶
------解决方案--------------------
for example:
--update BLOB
declare
a_blob BLOB;
bfile_name BFILE := BFILENAME( 'ULTLOBDIR ', 'log.txt ');
begin
update blobtest set col1=empty_blob() where rownum=1
returning col1 into a_blob;
dbms_lob.fileopen(bfile_name);
dbms_lob.loadfromfile(a_blob, bfile_name, dbms_lob.getlength(bfile_name));
dbms_lob.fileclose(bfile_name);
commit;
end;