create or replace procedure read_blob_pic
(pic_in_name varchar2,pic_out_name varchar2)
is
i_file utl_file.file_type;
i_buffer raw(32767);
i_amount binary_integer:=32767;
i_pos integer:=1;
i_blob blob;
i_blob_len integer;
begin
select pic_blob into i_blob from pic_info
where pic_name=pic_in_name;
i_blob_len:=dbms_lob.getlength(i_blob);
i_file:=utl_file.fopen('BLOBDIR',PIC_OUT_NAME,'wb',32767);
while i_pos<i_blob_len
loop
dbms_lob.read(i_blob,i_amount,i_pos,i_buffer);
utl_file.put_raw(i_file,i_buffer,true);
i_pos:=i_pos+i_amount;
end loop;
utl_file.fclose(i_file);
exception
when others then
if utl_file.is_open(i_file) then
utl_file.fclose(i_file);
end if;
raise;
end;
Oracle中下载数据库图片
最新推荐文章于 2020-08-17 17:04:16 发布