类型转换函数

          PALO

          类型转换函数

          Doris 支持以下类型转换函数

          1. cast

          CAST

          Description

          cast(expr as type)
          • 功能:转换函数通常会和其他函数一同使用,显示的将expression转换成指定的参数类型。Doris 对于函数的参数类型有严格的数据类型定义。例如 Doris 不会自动将 bigtint 转换成 int 类型,或者其余可能会损失精度或者产生溢出的转换。用户使用 cast 函数可以把列值或者字面常量转换成函数参数需要的其他类型。
          • 返回了类型:转换后的类型。

          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
          上一篇
          JSON解析函数
          下一篇
          格式转换函数