feedburner
Enter your email address:

Delivered by FeedBurner

feedburner count

Insert Blob into table

Labels:

first of all create a database directory as below:
create or replace directory ext_dir as 'c:\temp';

grant read,write on directory ext_dir to user_name;

select * from all_directories;

create table blob_table
(
blob_id number,
blob_data blob,
blob_file Bfile
);

insert into blob_table
values (1,empty_blob(), bfilename('ext_dir','r_test.csv'));

select * from blob_table;



Blob to Clob

Labels:

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;