Data types can be classified into groups of related data types. Within such groups, a precedence order exists where one data type is considered to precede another data type. This precedence is used to allow the promotion of one data type to a data type later in the precedence ordering. For example, the data type CHAR can be promoted to VARCHAR; INTEGER can be promoted to DOUBLE-PRECISION; but CLOB is NOT promotable to VARCHAR.
Table 1 shows the precedence list (in order) for each data type and can be used to determine the data types to which a given data type can be promoted. The table shows that the best choice is always the same data type instead of choosing to promote to another data type.
| Data Type | Data Type Precedence List (in best-to-worst order) |
|---|---|
| SMALLINT | SMALLINT, INTEGER, BIGINT, decimal, real, double, DECFLOAT |
| INTEGER | INTEGER, BIGINT, decimal, real, double, DECFLOAT |
| BIGINT | BIGINT, decimal, real, double, DECFLOAT |
| decimal | decimal, real, double, DECFLOAT |
| real | real, double, DECFLOAT |
| double | double, DECFLOAT |
| DECFLOAT | DECFLOAT |
| CHAR | CHAR, VARCHAR, CLOB |
| VARCHAR | VARCHAR, CLOB |
| CLOB | CLOB |
| GRAPHIC | GRAPHIC, VARGRAPHIC, DBCLOB |
| VARGRAPHIC | VARGRAPHIC, DBCLOB |
| DBCLOB | DBCLOB |
| BLOB | BLOB |
| DATE | DATE, TIMESTAMP |
| TIME | TIME |
| TIMESTAMP | TIMESTAMP |
| BOOLEAN | BOOLEAN |
| CURSOR | CURSOR |
| ARRAY | ARRAY |
| udt | udt (same name) or a supertype of udt |
| REF(T) | REF(S) (provided that S is a supertype of T) |
| ROW | ROW |
| Note:
|
|