Hi,
The idea is simply to download some CLOB contetnt as a file on the local machine.
The approach is the same as this .
My application page contains only the PL/SQL procedure as a process on post rendering , after region.
The content of the CLOB is displayed, not downloaded ?
I need a help to download the content of the CLOB "SOME TEXT..."
Regards,
Kostadin
The PL/SQL:
Declare
V_CLOB clob;
V_BLOB blob;
v_lang_context integer := DBMS_LOB.DEFAULT_LANG_CTX;
v_warning integer := DBMS_LOB.WARN_INCONVERTIBLE_CHAR;
v_dest_offset integer := 1;
v_source_offset integer := 1;
begin
v_CLOB:= 'SOME TEXT...';
dbms_lob.createtemporary(v_blob, true, DBMS_LOB.CALL);
sys.htp.init;
sys.owa_util.mime_header( 'application/octet-stream', FALSE,'UTF-8' );
sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( v_clob ));
sys.htp.p('Content-Disposition: attachment; filename="'||'FILE_NAME.txt'||'"' );
sys.owa_util.http_header_close;
dbms_lob.converttoblob (
dest_lob => V_BLOB,
src_clob => V_CLOB,
amount => DBMS_LOB.LOBMAXSIZE,
dest_offset => v_dest_offset,
src_offset => v_source_offset,
blob_csid => DBMS_LOB.DEFAULT_CSID,
lang_context=> v_lang_context,
warning => v_warning
);
sys.wpg_docload.download_file(v_blob);
DBMS_LOB.FREETEMPORARY (v_BLOB);
apex_application.stop_apex_engine;
exception when others then
sys.htp.prn('error: '||sqlerrm);
DBMS_LOB.FREETEMPORARY (v_BLOB);
apex_application.stop_apex_engine;
end;