Previous
Topic:
SAND CDBMS Data Types |
Next
Topic: Resulting Data Types |
All SQL operations involving operands, such as value expressions, INSERTs, UNIONs, and joins, require compatibility among the operand data types. The compatible data types are as follows:
- CHAR / CHARACTER and VARCHAR / CHARACTER VARYING / CHAR VARYING are compatible with each other.
- SMALLINT, INT, DECIMAL / DEC / NUMERIC, FLOAT, REAL, and DOUBLE PRECISION are all compatible.
- DATE is compatible only with DATE.
- TIME is compatible only with TIME.
- TIMESTAMP is compatible only with TIMESTAMP.
Generally, character data types are compatible with other character types, numeric data types with other numeric types, and date/time types with others of the exact same type. The exception is the BLOB data type, which is not compatible with any other type, and cannot even be compared to other BLOB instances.
One further restriction on INSERT operations is that an inserted character string cannot exceed the length of the target column data type or domain.