Application Development Guide


Why Use Distinct Types?

You can use data types that you have created, called user-defined distinct types, in your DB2 applications. There are several benefits associated with distinct types:

  1. Extensibility.

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

  2. 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. For more information on UDFs, see User-Defined Functions (UDFs) and Methods.

  3. Consistent behavior.

    Strong typing insures that your distinct types will behave appropriately. It guarantees that only functions defined on your distinct type can be applied to instances of the distinct type.

  4. Encapsulation.

    The set of functions and operators that you can apply to distinct types defines the behavior of your distinct types. This provides flexibility in the implementation since running applications do not depend on the internal representation that you choose for your type.

  5. Performance.

    Distinct types are highly integrated into the database manager. Because distinct types are internally represented the same way as built-in data types, they share the same efficient code used to implement built-in functions, comparison operators, indexes, etc. for built-in data types.


[ Top of Page | Previous Page | Next Page ]