What Extended Data Types Can Be Cast?
The next table shows the extended data type combinations
that you can cast.
| Target Type | Opaque Type | Distinct Type | Named ROW Type | Unnamed ROW Type | Collection Type | Built-in Type |
|---|---|---|---|---|---|---|
| Opaque Type | Explicit or implicit | Explicit | Explicit | Not Valid | Not Valid | Explicit or implicit3 |
| Distinct Type | Explicit3 | Explicit | Explicit | Not Valid | Not Valid | Explicit or implicit |
| Named ROW Type | Explicit3 | Explicit | Explicit3 | Explicit1 | Not Valid | Not Valid |
| Unnamed ROW Type | Not Valid | Not Valid | Explicit1 | Implicit1 | Not Valid | Not Valid |
| Collection Type | Not Valid | Not Valid | Not Valid | Not Valid | Explicit2 | Not Valid |
| Built-in Type | Explicit or implicit3 | Explicit or implicit | Not Valid | Not Valid | Not Valid | System defined (implicit) |
1 Applies when two ROW types are structurally equivalent or casts exist to handle data conversions where corresponding field types are not the same.
2 Applies when a cast exists to convert between the element types of the respective collection types.
3 Applies when a user-defined cast exists to convert between the two data types.
The table shows only whether a cast between a source type and a target type are possible. In some cases, you must first create a user-defined cast before you can perform a conversion between two data types. In other cases, the database server provides either an implicit cast or a built-in cast that you must explicitly invoke.