TRYCAST - Teradata Vantage NewSQL Engine - 16.20

Teradata Vantageā„¢ Data Types and Literals

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

Purpose

TRYCAST takes a string and tries to cast it to a data type specified after the AS keyword (similar to CAST). If the conversion fails, TRYCAST returns a NULL instead of failing.

Syntax



instring
A CHAR or VARCHAR expression in the LATIN or UNICODE character set.
data_type
One of the following supported data types:
  • BYTEINT
  • SMALLINT
  • INT
  • BIGINT
  • FLOAT
  • DECIMAL
  • NUMBER
  • CHAR (LATIN or UNICODE)
  • VARCHAR (LATIN or UNICODE)
  • DATE
  • TIME (with zone)
  • TIMESTAMP (with zone)
  • All INTERVAL types