更改Bi-Publisher RTF中的负数格式

huangapple go评论77阅读模式
英文:

Change negative number format in Bi-Publisher RTF

问题

我正在进行一个 RTF,希望你能帮助我,如何更改负数的格式?

将“-”更改为“()”

例如,我有:
821,292.87
-146,983.06
-671.64
503,927.51

我希望以以下方式看到它们:
821,292.87
(146,983.06)
(671.64)
503,927.51

英文:

I am doing an RTF I hope you can help me, how could I change the negative number format?

Change "-" for "()"

For example I have:
821,292.87
-146,983.06
-671.64
503,927.51

And I would like to see them in the following way:
821,292.87
(146,983.06)
(671.64)
503,927.51

答案1

得分: 1

你可以使用 PR 格式模型来在尖括号内获取负数:

SQL> select to_char(-146983.06,'999g999g999d99PR','NLS_NUMERIC_CHARACTERS = ''.,''') l 
       from dual;

L
----------------
    <146,983.06>

或者你也可以使用 regexp_replaceto_char 来实现:

regexp_replace( to_char(-146983.06,'tm9','NLS_NUMERIC_CHARACTERS = ''.,'''), 
                     '-(.*)','()' )

示例:

SQL> select regexp_replace( to_char(-146983.06,'tm9','NLS_NUMERIC_CHARACTERS = ''.,'''), 
                        '-(.*)','()' ) l 
       from dual;

L
------------------------------
(146983.06)
英文:

You can use PR format model to get negative numbers in angle brackets:

SQL&gt; select to_char(-146983.06,&#39;999g999g999d99PR&#39;,&#39;NLS_NUMERIC_CHARACTERS = &#39;&#39;.,&#39;&#39;&#39;) l 
       from dual;

L
----------------
    &lt;146,983.06&gt;

Or I would do this with regexp_replace and to_char:

regexp_replace( to_char(-146983.06,&#39;tm9&#39;,&#39;NLS_NUMERIC_CHARACTERS = &#39;&#39;.,&#39;&#39;&#39;), 
                     &#39;-(.*)&#39;,&#39;(\1)&#39; )

Example:

SQL&gt; select regexp_replace( to_char(-146983.06,&#39;tm9&#39;,&#39;NLS_NUMERIC_CHARACTERS = &#39;&#39;.,&#39;&#39;&#39;), 
                        &#39;-(.*)&#39;,&#39;(\1)&#39; ) l 
       from dual;

L
------------------------------
(146983.06)

huangapple
  • 本文由 发表于 2020年8月29日 08:18:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/63642285.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定