【问题标题】:Not able to convert numeric to String in postgres sql无法在 postgresql 中将数字转换为字符串
【发布时间】:2014-11-09 09:17:36
【问题描述】:

我无法将数字转换为字符串。例如下面是查询:

select to_char(50000.00,'999D99S')

任何帮助将不胜感激。

【问题讨论】:

    标签: postgresql numeric postgresql-9.2


    【解决方案1】:

    你必须添加更多9

    select to_char(50000.00,'99 999D99S');
    

    如果您不知道可以有多少小数,请执行以下操作:

    select to_char(50000.00,'999 999 999 999D99S');
    

    【讨论】:

      【解决方案2】:

      以下语法帮助了我:

      select 50000.00::text as content
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-02-26
        • 1970-01-01
        • 1970-01-01
        • 2018-12-09
        • 1970-01-01
        • 2012-09-19
        相关资源
        最近更新 更多