I was trying to understand the truncation error, I changed the values of the 
field marks1 and marks2 in the derbyTest-6783_1 and that '20' is basically the 
value of the integer field marks1 that I think is being cast as a char value. 
But I haven't been
able to track where this error is occurring.

    ERROR 22001: A truncation error was encountered trying to shrink CHAR '20' 
to length 1.


At first I thought "CHAR '20'" meant a character string of length 20, but
then I looked again at the funny way that '20' was written, and perhaps
it is the hex representation of an ASCII space character which has the
character code 0x20.

If the 20 is the length of the char field, then perhaps this is because
that's how the CHAR function works:

        http://db.apache.org/derby/docs/10.11/ref/rrefbuiltchar.html

        If the first argument is a BIGINT: The length of the result is 20.
        If the number of characters in the result is less than 20, then the
        result is padded on the right with blanks to length 20.

But I'm not sure where the CHAR function is coming into play in your trigger.

I agree with you, it's not obvious where this error is arising.

I'll try to find a bit of time to dig into this myself over the next day or two.

bryan

Reply via email to