Distinct data type

A distinct type has the same internal structure as an existing data type. However, it has a distinct name and therefore distinct functions that make it different from its source type. When you define a distinct type, you provide the following information:
  • The source data type, which defines the internal structure of the distinct data type

    The functions of the source data type determine how the database server interacts with this internal structure.

  • The operations that are valid on the distinct data type

    You define operator functions, built-in functions, or end-user routines that handle the distinct type. For information about building operator functions, see Extend operators and built-in functions.

  • Extensions of the operator class of a secondary-access method so that its strategy and support functions handle the distinct data type

    For information about support functions, see Write support functions.

  • Cast functions to provide the data conversions to and from the distinct type

    The database server automatically creates explicit casts between the distinct type and its source type. Because these two data types have the same internal format, this cast does not require a cast function. You can write cast functions to support data conversion between the distinct type and other data types in the database or to support implicit casts between the distinct type and its source data type. For information about writing casts, see Create user-defined casts.

You create a distinct data type with the CREATE DISTINCT TYPE statement. After you create the distinct type, you can use it anywhere that other data types are valid. For more information, refer to the description of this statement in the Informix® Guide to SQL: Syntax.