User-defined distinct types

A user-defined distinct type (UDT) is a mechanism to extend DB2® capabilities beyond the built-in data types that are available.

User-defined distinct types enable you to define new data types to DB2, which gives you considerable power because 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:

  • Extensibility.

    By defining new types, you can indefinitely increase the set of types provided by DB2 to support your applications.

  • Flexibility.

    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.

  • Consistent behavior.

    Strong typing ensures that your UDTs will behave appropriately. It guarantees that only functions defined on your UDT can be applied to instances of the UDT.

  • Encapsulation.

    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.

  • Extensible behavior.

    The definition of user-defined functions on types can augment the functionality provided to manipulate your UDT at any time.

  • Foundation for object-oriented extensions.

    UDTs are the foundation for most object-oriented features. They represent the most important step toward object-oriented extensions.