Friday, October 11, 2013

How to insert large string or xml file in the oracle database Clob field.





How to insert large string or xml file in the oracle database Clob field.
 

Solution:-

We can declare some variable and divide the large string into this.
Further while inserting the string or large file we can concentinate those variables and insert/update into database.

Sample code is
Declare
  str1 varchar2(4000);
  str2 varchar2(4000);
  str3 varchar2(4000);
  str4 varchar2(4000);

begin                                                                    
  str1 := 'Test data';                                                                                                             
  str2 := 'Test data';
  str3 := ' Test date';
  str4 := ' Test data';   
 
update TableName set coloumName = to_clob(str1) || to_clob(str2) || to_clob(str3) || to_clob(str4)

commit;

No comments:

Post a Comment