Jon*_*nas 28 postgresql datatypes type-conversion
我需要使用 PostgreSQL 将双精度值转换为 Bigint。我怎样才能做到这一点?
我试过,to_bigint(myvalue)但该功能不存在。
eev*_*var 44
在 Postgres 中有两种类型转换的方法:
您可以按照 SQL 标准方式进行操作:
select cast(3.141593 as bigint);
Run Code Online (Sandbox Code Playgroud)
或者您可以使用 Postgres 特定的强制转换运算符: ::
select (3.141593 :: bigint);
Run Code Online (Sandbox Code Playgroud)
您可能还需要考虑各种舍入函数。
| 归档时间: |
|
| 查看次数: |
74553 次 |
| 最近记录: |