presto中将DECIMAL可以转换的字段类型
时间: 2024-05-14 19:17:46 浏览: 197
presto sql 与mysql sql 对比.pdf
在Presto中,可以将以下字段类型转换为DECIMAL类型:
- VARCHAR
- CHAR
- BIGINT
- INTEGER
- SMALLINT
- TINYINT
- DECIMAL(可以转换为另一个DECIMAL类型)
例如,以下是将BIGINT转换为DECIMAL类型的示例:
```
SELECT CAST(1000000000000000000 AS BIGINT) AS bigint_value,
CAST(CAST(1000000000000000000 AS BIGINT) AS DECIMAL(30, 0)) AS decimal_value;
```
输出:
```
bigint_value | decimal_value
--------------+----------------------------
1000000000000000000 | 1000000000000000000
```
阅读全文