Creating a distinct type

Distinct types are useful when you want DB2® to handle certain data differently than other data of the same data type. For example, even though all currencies can be declared as type DECIMAL, you do not want euros to be compared to Japanese yen.

Procedure

To create a distinct type:

Issue the CREATE DISTINCT TYPE statement. For example, you can create distinct types for euros and yen by issuing the following SQL statements:
CREATE DISTINCT TYPE EURO AS DECIMAL(9,2);
CREATE DISTINCT TYPE JAPANESE_YEN AS DECIMAL(9,2);