SQL求助,求一个导出BLOB图片文件的过程
put_raw 的时候超过了文件写入的限制,怎么解决?
declare
lobloc blob;
buffer raw(2000);
amount int;
offset int:=1;
offset_size int:=2000;
handle utl_file.file_type;
begin
select photo into lobloc from lob_example2
where id=2;
amount:=dbms_lob.getlength(lobloc);
dbms_output.put_line(amount);
while (offset < amount) loop
dbms_lob.read(lobloc,offset_size,offset,buffer);
offset:=offset + offset_size;
handle:=utl_file.fopen('TT','a.jpg','w',offset_size);
utl_file.put_raw(handle,buffer);
dbms_output.put_line(offset);
utl_file.new_line(handle);
utl_file.fclose(handle);
end loop;
end ;