Blob to Clob
Posted by
www.2012updates.com
Labels:
PL/SQL
Here is a simple function that converts Blob into Vlob
create function blob_to_clob(v_blob in blob) return clob
as
v_clob clob;
n number;
begin
if (v_blob is null) then
return null;
end if;
if (length(v_blob)=0) then
return empty_clob();
end if;
dbms_lob.createtemporary(v_clob,true);
n:=1;
while (n+32767<=length(v_blob)) loop
dbms_lob.writeappend(v_clob,32767,utl_raw.cast_to_varchar2(dbms_lob.substr(v_blob,32767,n)));
n:=n+32767;
end loop;
dbms_lob.writeappend(v_clob,length(v_blob)-n+1,utl_raw.cast_to_varchar2(dbms_lob.substr(v_blob,length(v_blob)-n+1,n)));
return v_clob;
end;
Subscribe to:
Post Comments (Atom)
Post a Comment