1

Topic: String truncation for a query parameter

There is such parametric request:

V. CODE from VEGETA v
V. CODE similar to?

The field is defined so:

CODE varchar (10) NOT NULL

In the field number codes divided by the character ".", at first group from 3 digits, then on two.
It is caused so:

FB_MESSAGE (Input, ThrowStatusWrapper;
(FB_VARCHAR (40), fCODE_REG)
) inp (&fb_status, get_master ());
inp.clear ();
inp-> fCODE_REG.set (reg);
fdb-> openCursor (
&fb_status, tread.get (), 0, sql, SQL_DIALECT_CURRENT;
inp.getMetadata (), inp.getData (), out.getMetadata (), nullptr, 0
);

At reg = "[1-5 [1-4] _" - all is good.
At reg = "[1-5 [1-4] __" - the exception takes off:
[quote =] Dynamic SQL Error
-SQL error code =-303
-arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 10, actual 11

How it is possible to avoid it?