Truncated CHAR Values

In a database that is ANSI-compliant, if you assign a value to a CHAR(n) column or variable and the length of that value exceeds n characters, the database server raises an error -1279 when truncation of character data occurs.

But, in a database that is not ANSI-compliant, if you assign a value to a CHAR(n) column or variable and the length of that value exceeds n characters, the database server truncates the last characters without raising an error. For example, suppose that you define this table:
CREATE TABLE tab1 (col_one CHAR(2);
The database server truncates the data values in the following INSERT statements to "jo" and "sa" respectively, but does not return a warning:
INSERT INTO tab1 VALUES ("john");
INSERT INTO tab1 VALUES ("sally");

Thus, in a database that is not ANSI-compliant, the semantic integrity of data for a CHAR(n) column or variable is not enforced when the value inserted or updated exceeds the declared length n. (But in an ANSI-compliant database, the database server issues error -1279 when truncation of character data occurs.)

Note: Starting with Informix server versions 14.10.xC13, 15.0.0.2.3 and 15.0.1.x, in case of a non-ANSI database, truncation error -1279 can be requested (if the inserted value is longer than the maximum size of the column) using STRING_TRUNCATE_ERROR onconfig parameter or STRING_TRUNCATE_ERROR session environment option.