Error inserting datagram string too long into CLOB property of Oracle database

  • 2021-12-13 17:38:09
  • OfStack

Inserting one article (1000 ~ 2000) word into the database's CLOB property in a project today will report an error of too long a string.

The Internet said it would be handled by streaming, but it didn't do so. This is like an Bug, so long as the inserted data is expanded to more than 2000 by default, it will be ok.

Here's the code:


if((temp.length()>=1000)&&(temp.length()<=2000)){
temp=StringUtils.rightPad(temp, 2008);
}

Using the rightPad method of StringUtils, the part not exceeding 2000 is automatically filled with 0 on the right until the length of 2008.

(One half-width character has one byte and one full-width character has two bytes, so Chinese characters are 1000-2000, while English characters are 2000-4000)
Don 't hurry say have no choice, perhaps, next intersection will meet hope.


Related articles: