Insert CHAR data

An application can insert data from a character host variable (char, string, fixchar, varchar, or lvarchar) into a database column of type CHAR. If the value is shorter than the size of the database column then the database server pads the value with blanks up to the size of the column.

If the value is longer than the size of the column the database server truncates the value if the database is non-ANSI. No warning is generated when this truncation occurs. If the database is ANSI and the value is longer than the column size then the insert fails and this error is returned:
-1279: Value exceeds string column length.

Although char, varchar, lvarchar, and string host variables contain null terminators, Informix® ESQL/C never inserts these characters into a database column. (Host variables of type fixchar must never contain null characters.)

If you use the locale-sensitive character data type, NCHAR, you can insert a value from a character host variable into an NCHAR column. Insertion into NCHAR columns follows the same behavior as insertion into CHAR columns. For more information about how to declare host variables for the NCHAR data type, see the Informix GLS User's Guide.

Do not use the fixchar data type for host variables that insert character data into ANSI-compliant databases.