Using weakly typed UDTs
Weakly typed user-defined types provide a uniquely named data type while maintaining all the behavior rules of the base data type.
- columns in a table
- parameters, variables, or return columns for a function or procedure
- a global variable
- a sequence
By using a weakly typed distinct type, it becomes easy to identify all uses of a data type by Db2® for i objects. For example, if there is a weakly typed distinct type named PRICE, defined as DECIMAL(9,2), it is easy to query the database catalog to find all uses of the PRICE data type. By using this weak type in a table definition, a price type can be distinguished from any other column with a decimal data type. This makes it much easier to do impact analysis if you ever need to change a data type. Without a weak type, you would need to examine all tables that use a DECIMAL(9,2) data type. This can be a tedious process and would miss any price columns that use a different decimal precision or scale.
