Source and Target Data Types

The CREATE CAST statement defines a cast that converts a source type to a target type. Both the source and target data types must exist in the database when you execute the CREATE CAST statement to register the cast.

The source and the target data types have the following restrictions:
  • Either the source or the target type, but not both, can be a built-in data type.
  • Neither the source nor the target type can be a DISTINCT type of the other.
  • Neither the source nor the target types can be a COLLECTION data type.