Output field types
An output field can have a different data type from the one that is defined on a source table column if the data types are compatible. The UNLOAD utility follows the general Db2 rules and conventions for the data type attributes and the compatibility among the data types.
If you specify a data type in the UNLOAD control statement, the field type information is included in the generated LOAD utility statement. For specific data type compatibility information, refer to the following table. These tables show the compatibility of the data type of the source column (input data type) with the data type of the output field (output data type). A Y indicates that the input data type can be converted to the output data type.
The following table shows the compatibility of converting numeric data types.
Input data types | Output data types | ||||||
---|---|---|---|---|---|---|---|
SMALLINT | INTEGER (external) | BIGINT | DECIMAL (external) | FLOAT (external) | DOUBLE or REAL | FLOAT/REAL | |
SMALLINT | Y | Y1 | Y | Y1 | Y1 | Y | Y |
INTEGER | Y2 | Y1 | Y | Y1 | Y1 | Y | Y |
BIGINT | Y2 | Y2 | Y2 | Y | Y | N | Y |
DECIMAL | Y2 | Y1, 2 | Y2 | Y1 | Y1 | Y | Y |
FLOAT, DOUBLE, or REAL | Y2 | Y1, 2 | Y2 | Y1, 2 | Y1 | Y | Y |
DECFLOAT | Y2 | Y1, 2 | Y2 | Y1, 2 | Y1, 2 | N2 | Y3 |
Note:
|
The following table shows the compatibility of converting character data types.
Input data types | Output data types | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
BLOB | CHAR | VAR-
CHAR |
CLOB | GRAPHIC | GRAPHIC
EXTER- NAL |
VAR-
GRAPHIC |
DB-
CLOB |
BINARY |
VAR-
BINARY |
|
BLOB | Y | N | N | N | N | N | N | N | N | N |
CLOB | N | Y1, 2 | Y1, 2 | Y | N | N | N | N | N | N |
DBCLOB | N | N | N | N | Y1, 2 | Y1, 2, 3 | Y1, 2 | Y1 | N | N |
CHAR | N | Y1 | Y1 | Y1, 4 | N | N | N | N | Y | Y |
VARCHAR
or LONG VARCHAR |
N | Y1,2 | Y1 | Y1, 4 | N | N | N | N | Y | Y |
GRAPHIC | N | N | N | N | Y1 | Y1, 3 | Y1 | Y1 | N | N |
VAR-
GRAPHIC or LONG VAR- GRAPHIC |
N | N | N | N | Y1, 2 | Y1, 2, 3 | Y1 | Y1 | N | N |
BINARY | Y | N | N | N | N | N | N | N | Y | Y |
VARBINARY | Y | N | N | N | N | N | N | N | Y | Y |
Note:
|
The following table shows the compatibility of converting time data types.
Input data types | Output data types | |||
---|---|---|---|---|
DATE EXTERNAL | TIME EXTERNAL | TIMESTAMP EXTERNAL | TIMESTAMP WITH TIME ZONE EXTERNAL | |
DATE | Y1 | N | Y1, 2 | Y1,2 |
TIME | N | Y1 | N | N |
TIMESTAMP | Y1, 3 | Y1, 3 | Y1 | Y1,2 |
TIMESTAMP WITH TIME ZONE | Y1,4 | Y1,4 | Y1,4 | Y1 |
Note:
|