HPL/SQL is included to Apache Hive since version 2.0
HPL/SQL is included to Apache Hive since version 2.0
CAST function converts an expression to the specified data type.
Syntax:
CAST(expression AS datatype[(length)]);
Notes:
Example 1:
Convert to a string with the specified length:
CAST('Abc' AS CHAR(1)); -- A
Example 2:
Truncate a timestamp string:
CAST(TIMESTAMP '2015-03-12 10:58:34.111' AS CHAR(10)); -- 2015-03-12
Compatibility: Oracle, Microsoft SQL Server, IBM DB2, Teradata, PostgreSQL, MySQL and Netezza
Version: PL/HQL 0.03