百度智能云

All Product Document

          Data Warehouse

          Type Conversion Function

          Palo supports the following types of conversion functions

          1. cast

          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
          Previous
          Time and Date Function
          Next
          Aggregate Function