首页 > Linux操作系统 > Linux操作系统 > oracle 提取blob对象
grant read, write on directory lcc_dir to lcc;
4:创建提取过程
create or replace procedure download_blob(srcname varchar2, dstname varchar2) as
mount binary_integer := 32767;
fbuffer raw(32767);
utlfile utl_file.file_type;
dumpfile blob;
pos integer := 1;
len binary_integer;
begin
select blob_file into dumpfile from blob_tb where data_name = srcname;
len := dbms_lob.getlength(dumpfile);
utlfile := utl_file.fopen('LCC_DIR', dstname, 'wb', 32767);
while pos < len loop
dbms_lob.read(dumpfile, mount, pos, fbuffer);
utl_file.put_raw(utlfile, fbuffer, true);
pos := pos + mount;
end loop;
utl_file.fclose(utlfile);
end;
/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24751301/viewspace-678030/ ,如需转载,请注明出处,否则将追究法律责任。