Oracle blob to clob
function f_blob_to_clob(blob_in in blob) return clob as
v_clob clob;
v_varchar varchar(32767);
v_start pls_integer := 1;
v_buffer pls_integer := 32767;
begin
dbms_lob.createtemporary(v_clob, true);
for i in 1 .. ceil(dbms_lob.getlength(blob_in) / v_buffer) loop
v_varchar := utl_raw.cast_to_varchar2(dbms_lob.substr(blob_in,
v_buffer,
v_start));
dbms_lob.writeappend(v_clob, length(v_varchar), v_varchar);
v_start := v_start + v_buffer;
end loop;
return v_clob;
end f_blob_to_clob;
or use apex wwv_flow_utilities.blob_to_clob
v_clob clob;
v_varchar varchar(32767);
v_start pls_integer := 1;
v_buffer pls_integer := 32767;
begin
dbms_lob.createtemporary(v_clob, true);
for i in 1 .. ceil(dbms_lob.getlength(blob_in) / v_buffer) loop
v_varchar := utl_raw.cast_to_varchar2(dbms_lob.substr(blob_in,
v_buffer,
v_start));
dbms_lob.writeappend(v_clob, length(v_varchar), v_varchar);
v_start := v_start + v_buffer;
end loop;
return v_clob;
end f_blob_to_clob;
or use apex wwv_flow_utilities.blob_to_clob
Comments
Post a Comment