db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Segel" <mse...@segel.com>
Subject RE: ERROR 22001
Date Mon, 24 Jul 2006 14:47:55 GMT
The .trim() method of a String will truncate the ending white space.
You can do a substring with a starting position of 0 and the MAX value of a
VARCHAR (which should be a constant somewhere).

This should ensure that the string is truncated and will fit.

> -----Original Message-----
> From: Kristian.Waagan@Sun.COM [mailto:Kristian.Waagan@Sun.COM]
> Sent: Monday, July 24, 2006 6:26 AM
> To: Derby Discussion
> Subject: Re: ERROR 22001
> 
> Jitendra Kharche wrote:
> > Hi,
> >
> > I am using Derby that is embedded in Websphere App Server Community
> Edition.
> > I get the following error
> > ERROR 22001: A truncation error was encountered trying to shrink VARCHAR
> > Can anybody explain about this and how can i remove it.
> 
> Hello Jitendra,
> 
> To me it looks like the data that is inserted into Derby is too large
> (ie. the string is too long). The maximum size of VARCHAR in Derby is
> 32672 characters. It might also be that the column is defined to have a
> smaller maximum length.
> 
> As for truncation, only trailing whitespace can be truncated.
> 
> You could check the length of your data and the maximum length of the
> column it is inserted into.
> If the data is too long, you can increase the size of your VARCHAR column.
> If you need to store larger amounts of texts, you might have to use CLOB
> instead.
> 
> You also have LONG VARCHAR. It is the same as VARCHAR, but you don't
> need to specify a maximum length when you create the table. It can hold
>   a maximum of 32700 characters.
> 
> 
> 
> 
> Regards,
> --
> Kristian
> 
> >
> > Regards,
> > Jitendra




Mime
View raw message