Updated on 2025-08-14 GMT+08:00

Type Conversion Functions

This section describes type conversion functions, including their syntax, parameters, and usage examples.

Function List

Table 1 Type conversion functions

Function

Description

cast

Converts a value from one data type to another and provides the data type to dynamic parameters.

cast

This function converts a value from one data type to another and provides the data type to dynamic parameters.

The cast expressions can be used wherever expressions are allowed.

Syntax: CAST(Expression as Datatype)

Table 2 Parameter description

Parameter

Description

Type

Mandatory

expression

Source type of the expression.

Any

Yes

Datatype

Target type.

SQL data type, such as bigint, varchar, double, double precision, boolean, timestamp, decimal, integer, char, or date

Yes

Table 3 Mapping between index and SQL data types

Index Data Type

SQL Data Type

Long

Bigint

String

Varchar

Float

Double or double precision

Return value type: target data type

Example: select cast(time as date)

Table 4 Query and analysis results

Type

Query Statement

Returned Result

Scenario

cast(time as date)

2023-08-31 23:11:17.000