A user-defined distinct type is a data type derived from an existing type, such as an integer, decimal, or character type. To define a distinct type, you use the CREATE DISTINCT TYPE statement.
Instances of the same distinct type can be compared to each other, if the WITH COMPARISONS clause is specified on the CREATE DISTINCT TYPE statement (as in the example in the procedure). The WITH COMPARISONS clause cannot be specified if the source data type is a large object, LONG VARCHAR, or LONG VARGRAPHIC type.
For the list of privileges required to define distinct types, see the CREATE DISTINCT TYPE statement. CREATE DISTINCT TYPE T_EDUC AS SMALLINT WITH COMPARISONS
Because the distinct type defined in the preceding statement is based on SMALLINT, the WITH COMPARISONS parameters must be specified.
CREATE TABLE EMPLOYEE
(EMPNO CHAR(6) NOT NULL,
FIRSTNME VARCHAR(12) NOT NULL,
LASTNAME VARCHAR(15) NOT NULL,
WORKDEPT CHAR(3),
PHONENO CHAR(4),
PHOTO BLOB(10M) NOT NULL,
EDLEVEL T_EDUC)
IN RESOURCE