Data type compatibility for assignments and comparisons

Assignment operations are performed during the execution of INSERT and UPDATE statements. Comparison operations are performed during the execution of statements that include predicates. The data types of the operands involved must be compatible, as shown in Table 16 through Table 18.

If the data type column contains:

X
The data types of the operands are compatible.

blank
The data types of the operands are not compatible.

Table 16. Data type compatibility, table 1

SQL data type INT SMALLINT DECIMAL BLOB
INT X X X
VARCHAR



BLOB


X
DECIMAL X X X
CHAR



SMALLINT X X X
DATE



TIME



TIMESTAMP




Table 17. Data type compatibility, table 2

SQL data type CHAR VARCHAR
INT

VARCHAR X X
BLOB

DECIMAL

CHAR X X
SMALLINT

DATE X X
TIME X X
TIMESTAMP X X

Table 18. Data type compatibility, table 3

SQL data type DATE TIME TIMESTAMP
INT


VARCHAR X X X
BLOB


DECIMAL


CHAR X X X
SMALLINT


DATE X

TIME
X
TIMESTAMP

X

Related reference