CREATE OR REPLACE Procedure Img_File_Generation
is
v_blob blob;
v_data_length Number;
v_chunk CONSTANT NUMBER := 32767; -- maximum chunk size
v_offset Number:=1;
OutPutFile utl_file.file_type;
begin
OutPutFile := utl_file.fopen ('MY_DIR', 'test.img', 'ab', v_chunk);
For i in (select image_Name
From Table_Name
)
Loop
v_offset := 1;
v_blob := i.image_name;
v_data_length := DBMS_LOB.getlength (v_blob);
Loop
Exit When v_offset > v_data_length;
utl_file.put_raw (OutPutFile, DBMS_LOB.SUBSTR (v_blob, v_chunk, v_offset), true);
v_offset := v_offset + v_chunk;
End Loop;
End loop;
utl_file.fflush(OutPutFile);
utl_file.fclose_all;
Exception
when others then
utl_file.fflush(OutPutFile);
utl_file.fclose_all;
End Img_File_Generation;
/
No comments:
Post a Comment