CREATE TYPE statement

The CREATE TYPE statement defines a user-defined data type at the current server.

Five different kinds of user-defined data types can be created using this statement. Each of these types is described separately.
  • Array. A user-defined data type that is an ordinary array or an associative array. The elements of an array type are based on one of the built-in data types or a user-defined type other than a cursor type or structured type.
  • Cursor. A user-defined data type that is a cursor type.
  • Distinct. A user-defined data type that is sourced on one of the built-in data types and can be defined to use strong type rules or weak type rules.. Functions that cast between the user-defined distinct type and the source built-in data type are generated when a strongly typed distinct type is created. Optionally, support for comparison operations to use with the strongly typed distinct type can be generated when the user-defined distinct type is created.
  • Row. A user-defined data type that represents a row. It includes one or more fields with associated data types that make up a row of data.
  • Structured. A user-defined data type that represents an object and associated methods. It may include zero or more attributes and may be a subtype allowing attributes to be inherited from a supertype. Some methods are generated when the user-defined structured type is created and others can be specified as part of the definition.