Creating a type mapping for a data source data type and version - example

In this example, Oracle tables and views exist on different versions of the Oracle server. For all tables and views on Oracle Version 8.0.3 servers, columns that use the Oracle NUMBER(23,3) data type must map to the DECIMAL(8,2) data type.

The Oracle NUMBER(23,3) data type is mapped by default to the DECIMAL(23,3) data type. Use the ALTER NICKNAME statement to change the local types of existing nicknames. You must modify each nickname separately to change the local data type to DECIMAL(8,2). If the nicknames do not exist, create a data type mapping that specifies the data source type. Ensure that the data source wrapper is created before running the CREATE TYPE MAPPING statement. To map the Oracle NUMBER(23,3) data type to the DECIMAL(8,2) data type for Oracle servers using Version 8.0.3, run the CREATE TYPE MAPPING statement, for example:
CREATE TYPE MAPPING ORA_DEC FROM SYSIBM.DECIMAL(8,2) 
    TO SERVER TYPE ORACLE VERSION 8.0.3 TYPE NUMBER(23,3) 
ORA_DEC
The name that you give to the type mapping. The name cannot duplicate a data type mapping name that already exists in the catalog.
FROM SYSIBM.DECIMAL(8,2)
The local Db2® schema and the local data type. If the length or precision and scale are not specified, then these values are determined from the source data type.
TO SERVER TYPE ORACLE
The type of data source.
VERSION 8.0.3
The version of data source server. You must specify the version. You can also specify the release and the modification of the release, as shown in this example.
TYPE NUMBER(23,3)
The data source data type that you are mapping to the local data type. User-defined data types are not allowed.

The federated database defines the DECIMAL(8,2) data type locally for the Oracle columns on Version 8.0.3 servers. Oracle tables and views on servers that do not use Version 8.0.3 instead use the default data type mapping. When you create nicknames on Oracle tables and views that contain NUMBER columns, the Oracle NUMBER data type maps to the Db2 DECIMAL(8,2) data type.