Type Conversion Function
Last Updated:2021-04-13
Palo supports the following types of conversion functions
CAST
Description
cast(expr as type)
- Function: generally the conversion functions are used in combination with other functions, showing the conversion of expression to specified parameter type. Palo has strict definition of data type for parameter types of functions. For example, Palo will not automatically convert bigtint type to int type, or execute other conversions that may lose precision or overflow. Users can use cast function to convert column values or literal constants into other types required by function parameters.
- Return type: type after conversion.
Example
mysql> select concat('Here are the first ', cast(10 as string), ' results.');
+-------------------------------------------------------------------+
| concat('Here are the first ', CAST(10 AS CHARACTER), ' results.') |
+-------------------------------------------------------------------+
| Here are the first 10 results. |
+-------------------------------------------------------------------+
Keywords
cast