Strong typing in user-defined distinct types
One of the most important concepts associated with distinct types is strong typing. Strong typing guarantees that only functions and operators defined explicitly on the distinct type can be applied to its instances.
Strong typing is important to ensure that the instances of your distinct types are correct. For example, if you have defined a function to convert US dollars to Canadian dollars according to the current exchange rate, you do not want this same function to be used to convert euros to Canadian dollars because it will certainly return the wrong amount.
As a consequence of strong typing, Db2® does not allow you to write queries that compare, for example, distinct type instances with instances of the source type of the distinct type. For the same reason, Db2 will not let you apply functions defined on other types to distinct types. If you want to compare instances of distinct types with instances of another type, you have to cast the instances of one or the other type. In the same sense, you have to cast the distinct type instance to the type of the parameter of a function that is not defined on a distinct type if you want to apply this function to a distinct type instance.