IBM Books

Application Development Guide


Why Use UDTs?

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

  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).

  3. Consistent behavior.

    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.

  4. Encapsulation.

    The set of functions and operators that you can apply to UDTs defines the behavior of your UDTs. 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.

  6. Foundation for object-oriented extensions.

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


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]