Link to home
Start Free TrialLog in
Avatar of prashant_n_mhatre
prashant_n_mhatre

asked on

BLOB to CLOB copy

I have a data in one table of type BLOB. I need to copy it into a CLOB in another table. Does anyone have code?

Thanks
Avatar of Ranjithls
Ranjithls

u should use dbms_lob oackage for this to work out

here is an example of code

declare
  from_col blob;
  to_col   clob;
  byt_copy integer;
  off_write integer;
  off_read integer;

begin
  byt_copy := 55;  --bytes to copy

  off_write := 1;  --offset to start writing within      
                   --destination lob value

  off_read := 1;   --offset to start reading from within
                   --within destination lob value

  select blob_column into from_col from source_table;

  select clob_column into to_col from dest_table;

  dbms_lob.copy(to_col, from_col, byt_copy, off_write, off_read);

  commit;
end;
u should use dbms_lob oackage for this to work out

here is an example of code

declare
 from_col blob;
 to_col   clob;
 byt_copy integer;
 off_write integer;
 off_read integer;

begin
 byt_copy := 55;  --bytes to copy

 off_write := 1;  --offset to start writing within      
                  --destination lob value

 off_read := 1;   --offset to start reading from within
                  --within destination lob value

 select blob_column into from_col from source_table;

 select clob_column into to_col from dest_table;

 dbms_lob.copy(to_col, from_col, byt_copy, off_write, off_read);

 commit;
end;
Avatar of prashant_n_mhatre

ASKER

Doesn't work...

dbms_lob.copy(to_col, from_col, byt_copy, off_write, off_read);

this statement gives error.

ASKER CERTIFIED SOLUTION
Avatar of waynezhu
waynezhu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial