A user-defined distinct type is a mechanism that allows you to extend DB2® capabilities beyond the built-in data types available.
User-defined distinct types enable you to define new data types to DB2 which gives you considerable power since you are no longer restricted to using the system-supplied built-in data types to model your business and capture the semantics of your data. Distinct data types allow you to map on a one-to-one basis to existing database types.
These benefits are associated with UDTs:
By defining new types, you can indefinitely increase the set of types provided by DB2 to support your applications.
You can specify any semantics and behavior for your new type by using user-defined functions (UDFs) to augment the diversity of the types available in the system.
Strong typing insures that your UDTs will behave appropriately. It guarantees that only functions defined on your UDT can be applied to instances of the UDT.
The behavior of your UDTs is restricted by the functions and operators that can be applied on them. This provides flexibility in the implementation since running applications do not depend on the internal representation that you chose for your type.
The definition of user-defined functions on types can augment the functionality provided to manipulate your UDT at any time.
UDTs are the foundation for most object-oriented features. They represent the most important step toward object-oriented extensions.