Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > INSERT >

Truncated CHAR Values

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.)

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]