User-defined types

A user-defined type is a data type that is defined to the database using a CREATE statement.

There are two types of user-defined data type:

  • Distinct type
  • Array type

A distinct type is a user-defined type that shares its internal representation with a built-in data type (its source type), but is considered to be a separate and incompatible data type for most operations. A distinct type is created with an SQL CREATE TYPE (Distinct) statement. A distinct type can be used to define a column of a table, or a parameter of a routine. For more information, see CREATE TYPE (distinct) and User-defined types.

An array type is a user-defined type that defines a one column array of a built-in data type. An array type is created with an SQL CREATE TYPE (Array) statement. An array type can be used as a parameter of Start of changea procedure or scalar function and as a variable in an SQL procedure or SQL scalar function.End of change For more information, see CREATE TYPE (array) and User-defined types.