加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL学习篇9.5 货币类型

发布时间:2020-12-13 16:59:40 所属栏目:百科 来源:网络整理
导读:货币类型可以存储固定小数的货币数目,完全保证精度。其输出格式与参数lc_monetary设置有关,不同国家的货币输出格式不同。示例:postgres=# show lc_monetary; lc_monetary------------- en_US.UTF-8(1 row)postgres=# select '123.34'::money; money -----
货币类型可以存储固定小数的货币数目,完全保证精度。其输出格式与参数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)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读