Rules for the Target Data Type

The following rules restrict the target data type in cast expressions:
  • The target data type must be either a built-in type, a user-defined type, or a named row type in the database.
  • The target data type cannot be an unnamed row or a collection type.
  • The target data type can be a BLOB data type under the following conditions:
    • The source expression (the expression to be cast to another data type) is a BYTE data type.
    • The source expression is a user-defined type and the user has defined a cast from the user-defined type to the BLOB type.
  • The target data type can be a CLOB type under these conditions:
    • The source expression is a TEXT data type.
    • The source expression is a user-defined type and the user has defined a cast from the user-defined type to the CLOB type.
  • You cannot cast a BLOB data type to a BYTE data type.
  • You cannot cast a CLOB data type to a TEXT data type.
  • An explicit or implicit cast must exist that can convert the data type of the source expression to the target data type.