Example 1: Create a distinct type named SHOESIZE that is sourced on the built-in INTEGER data type.
CREATE DISTINCT TYPE SHOESIZE AS INTEGER WITH COMPARISONS
The successful execution of this statement also generates two cast functions. Function INTEGER(SHOESIZE) returns a value with data type INTEGER, and function SHOESIZE(INTEGER) returns a value with distinct type SHOESIZE.
Example 2: Create a distinct type named MILES that is sourced on the built-in DOUBLE data type.
CREATE DISTINCT TYPE MILES AS DOUBLE WITH COMPARISONS
The successful execution of this statement also generates two cast functions. Function DOUBLE(MILES) returns a value with data type DOUBLE, and function MILES(DOUBLE) returns a value with distinct type MILES.
Example 3: Create a distinct type T_DEPARTMENT that is sourced on the built-in CHAR data type.
CREATE DISTINCT TYPE CLAIRE.T_DEPARTMENT AS CHAR(3) WITH COMPARISONS
The successful execution of this statement also generates three cast functions:
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.