16.20 - AS ASSIGNMENT - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Content Type
Programming Reference
Publication ID
B035-1144-162K
Language
English (United States)
Last Update
2019-05-24
To implicitly invoke the specified cast routine on an assignment operation if both of the following statements are true:
  • The source data type of the assignment is compatible with the source data type of the cast result.
  • The target data types are identical.
Note that an assignment operation is defined to be any of the following operations:
  • INSERT
  • UPDATE
  • parameter passing

You can disable this functionality by means of the DisableImplCastForSysFuncOp DBS Control parameter.

Be very careful if you are performing a REPLACE CAST statement because the system updates the UDTCast dictionary to reflect the value of the AS ASSIGNMENT flag.

Example: Casting Source Data as VARCHAR with an Assignment Operation

The following CREATE CAST request creates a cast operation that converts the source data type euro to the target data type VARCHAR(20) using the method euroString.

The casting routine is defined so it is implicitly invoked on an assignment operation assuming the necessary conditions are met for the assignment.

     CREATE CAST (euro AS VARCHAR(20))
     WITH METHOD SYSUDTLIB.euroString( ) FOR euro
     AS ASSIGNMENT