для 10g, авторство скрипта -
whitelion
Код:
declare
c_location varchar2(80) := 'DIR1';
c_filename varchar2(160);
v_handle Utl_File.File_Type;
lob_loc BLOB;
offset INTEGER := 1;
l_amount INTEGER := 32767;
a raw(32767);
begin
for cur1 in (select article from smcardimage) loop
SELECT theimage INTO lob_loc
FROM smcardimage
WHERE article = cur1.article;
select concat(r.article,'.jpg') into c_filename from smcardimage r where r.article=cur1.article;
v_handle := Utl_File.Fopen (
location => c_location,
filename => c_filename,
open_mode => 'WB',
max_linesize => 32767 );
a := dbms_lob.substr(lob_loc,l_amount,offset);
Utl_File.put_raw(v_handle,a,true);
Utl_File.FClose(v_handle);
c_filename :='';
end loop;
end;
DIR1, соответственно - директория выгрузки