您的位置:首页 > 数据库

PostgreSQL学习篇9.5 货币类型

2016-12-19 13:35 330 查看
货币类型可以存储固定小数的货币数目,完全保证精度。其输出格式与参数lc_monetary设置有关,不同国家的货币输出格式不同。

示例:
postgres=# show lc_monetary;
lc_monetary
-------------
en_US.UTF-8
(1 row)

postgres=# select '123.34'::money;
money
---------
$123.34
(1 row)

postgres=# set lc_monetary='zh_cn.utf-8';              ---看来严格区分大小写
ERROR:  invalid value for parameter "lc_monetary": "zh_cn.utf-8"
postgres=# set lc_monetary='zh_CN.UTF-8';
SET
postgres=# show lc_monetary;
lc_monetary
-------------
zh_CN.UTF-8
(1 row)

postgres=# select '123.34'::money;
money
----------
锟23.34   ----why
(1 row)
---调整SecureCRT显示字符为UTF-8之后
postgres=# select '12.34'::money;
money
---------
¥12.34
(1 row)

postgres=# create table testm(rmb money);
CREATE TABLE
postgres=# insert into testm values(11);
INSERT 0 1
postgres=# select * from testm;
   rmb   
---------
 ¥11.00
(1 row) 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: