This page contains the explicit conversion functions supported by e6data.
CAST FUNCTION
CAST( <expr> as <target datatype> )
Converts the input expression to the specified target datatype.
cast('2022-01-11'asdate)
The following table contains a matrix of all supported conversions:
Source(Row) Target(Column)
varchar
integer/int
bigint
float
double
boolean
date
timestamp
varchar
Y
Y
Y
Y
Y
Y
Y
Y
integer/int
Y
Y
Y
Y
Y
Y
-
-
bigint
Y
Y
Y
-
-
-
-
-
float
Y
Y
-
Y
Y
-
-
-
double
Y
Y
Y
Y
Y
-
-
-
boolean
Y
-
-
-
-
Y
-
-
date
Y
-
-
-
-
-
Y
Y
timestamp
Y
-
-
-
-
-
Y
Y
TRY CAST FUNCTION
TRY_CAST( <input datatype> , <output datatype> )
Converts the input expression to the specified target datatype, but returns a NULL value instead of raising an error when the conversion can not be performed.
Usages
Support datatype: VARCHAR, NUMBER (or any of its synonyms), DOUBLE, BOOLEAN, DATE, TIMESTAMP
try_cast to DATE accept 'YYYY-MM-DD' format for other formats returns null
try_cast to TIMESTAMP accept 'YYYY-MM-DD HH:mm:ss' format for other formats returns null
FORMAT( <format_string>, <value>)
Converts the input expression to the specified target datatype.
This function produces a string in a specific format by utilising the provided format string and arguments.
Support datatype: INT/FLOAT/DOUBLE/STRING/DATE/TIMESTAMP/BOOL