Promotion of data types

Data types can be classified into groups of related data types. Within such groups, an order of precedence exists where one data type is considered to precede another data type. This precedence enables the database manager to support the promotion of one data type to another data type that appears 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 VARCHAR.

The database manager considers the promotion of data types when:

For each data type, Table 11 shows the precedence list (in order) that the database manager uses to determine the data types to which each data type can be promoted. The table indicates that the best choice is the same data type and not promotion to another data type. Note that the table also shows data types that are considered equivalent during the promotion process. For example, CHARACTER and GRAPHIC are considered to be equivalent data types.

Table 11. Data Type Precedence Table
Data Type Data Type Precedence List (in best-to-worst order)
SMALLINT SMALLINT, INTEGER, BIGINT, decimal, real, double
INTEGER INTEGER, BIGINT, decimal, real, double
BIGINT BIGINT, decimal, real, double
decimal decimal, real, double
real real, double
double double
CHAR or GRAPHIC CHAR or GRAPHIC, VARCHAR or VARGRAPHIC, CLOB or DBCLOB
VARCHAR or VARGRAPHIC VARCHAR or VARGRAPHIC, CLOB or DBCLOB
CLOB or DBCLOB CLOB or DBCLOB
BINARY BINARY, VARBINARY, BLOB
VARBINARY VARBINARY, BLOB
BLOB BLOB
DATE DATE
TIME TIME
TIMESTAMP TIMESTAMP
DATALINK DATALINK
ROWID ROWID
udt same udt
Note:

The lower case types above are defined as follows:

decimal
= DECIMAL(p,s) or NUMERIC(p,s)
real
= REAL or FLOAT(n) where n is a specification for single precision floating point
double
= DOUBLE, DOUBLE PRECISION, FLOAT or FLOAT(n) where n is a specification for double precision floating point
udt
= a user-defined type

Shorter and longer form synonyms of the data types listed are considered to be the same as the synonym listed.

Character and graphic strings are only compatible for Unicode data.



[ Top of Page | Previous Page | Next Page | Contents | Index ]