In DB2® Version 10.1
Fix Pack 2 and later fix packs, distinct types can use strong typing
or weak typing rules.
A distinct type is a user-defined data type that shares its internal
representation with an existing built-in data type (its source type).
A distinct type is defined to use either strong typing or weak typing
rules. Previous versions of DB2 for Linux, UNIX, and Windows only
supported strong typing.
- Strongly typed distinct type
- A strongly typed distinct type is considered to be a separate
and incompatible type for most operations. It restricts most operations
where the data type names of the operands do not match.
- Weakly typed distinct type
- A weakly typed distinct type is considered to be the same as its
source type for all operations, except when the weakly typed distinct
type applies constraints on values during assignments or casts. It
allows most operations as if the operand uses the built-in data type
it represents.
Weakly typed distinct types provide you with the ability
to centralize the definition of a particular data type and then use
the data type across your code base without the restrictiveness of
strong typing for operations like comparisons and function resolution.
The added flexibility to manage the valid values (through data type
constraints) adds an extra level of validation to the use of this
single data type definition.