• <small id='w7fbz'></small><noframes id='w7fbz'>

        <legend id='w7fbz'><style id='w7fbz'><dir id='w7fbz'><q id='w7fbz'></q></dir></style></legend>
        <i id='w7fbz'><tr id='w7fbz'><dt id='w7fbz'><q id='w7fbz'><span id='w7fbz'><b id='w7fbz'><form id='w7fbz'><ins id='w7fbz'></ins><ul id='w7fbz'></ul><sub id='w7fbz'></sub></form><legend id='w7fbz'></legend><bdo id='w7fbz'><pre id='w7fbz'><center id='w7fbz'></center></pre></bdo></b><th id='w7fbz'></th></span></q></dt></tr></i><div id='w7fbz'><tfoot id='w7fbz'></tfoot><dl id='w7fbz'><fieldset id='w7fbz'></fieldset></dl></div>

          <bdo id='w7fbz'></bdo><ul id='w7fbz'></ul>
        <tfoot id='w7fbz'></tfoot>

        NLS_NUMERIC_CHARACTERS 十进制设置

        时间:2023-09-20

          <bdo id='N99f4'></bdo><ul id='N99f4'></ul>
          <legend id='N99f4'><style id='N99f4'><dir id='N99f4'><q id='N99f4'></q></dir></style></legend>
                <tbody id='N99f4'></tbody>

              1. <small id='N99f4'></small><noframes id='N99f4'>

                <i id='N99f4'><tr id='N99f4'><dt id='N99f4'><q id='N99f4'><span id='N99f4'><b id='N99f4'><form id='N99f4'><ins id='N99f4'></ins><ul id='N99f4'></ul><sub id='N99f4'></sub></form><legend id='N99f4'></legend><bdo id='N99f4'><pre id='N99f4'><center id='N99f4'></center></pre></bdo></b><th id='N99f4'></th></span></q></dt></tr></i><div id='N99f4'><tfoot id='N99f4'></tfoot><dl id='N99f4'><fieldset id='N99f4'></fieldset></dl></div>
                <tfoot id='N99f4'></tfoot>

                  本文介绍了NLS_NUMERIC_CHARACTERS 十进制设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在测试机器上设置了一个数据库,在生产机器上设置了第二个.当我跑步时:

                  I have one db setup in a test machine and second in production machine. When I run:

                  select to_number('100,12') from dual 
                  

                  然后它在测试机器中给出错误.然而,这个语句在生产机器上工作得很好.

                  Then it gives error in test machine. However, this statement works quite fine in production machine.

                  现在,当我检查 NLS_NUMERIC_CHARACTERS 时,我会在两台机器上看到,"(逗号).还有其他地方我应该寻找小数设置吗?

                  Now, when I check for NLS_NUMERIC_CHARACTERS then I see ',' (comma) in both machine. Is there anywhere else I should be looking for the decimal setting?

                  干杯!

                  推荐答案

                  您可以通过查询nls_session_parameters来查看您当前的会话设置:

                  You can see your current session settings by querying nls_session_parameters:

                  select value
                  from nls_session_parameters
                  where parameter = 'NLS_NUMERIC_CHARACTERS';
                  
                  VALUE                                  
                  ----------------------------------------
                  .,                                       
                  

                  这可能与数据库默认值不同,您可以在 nls_database_parameters 中看到.

                  That may differ from the database defaults, which you can see in nls_database_parameters.

                  在此会话中您的查询错误:

                  In this session your query errors:

                  select to_number('100,12') from dual;
                  
                  Error report -
                  SQL Error: ORA-01722: invalid number
                  01722. 00000 -  "invalid number"
                  

                  我可以直接使用 alter session 更改我的会话,或者通过确保我的客户端以导致设置字符串需要的方式进行配置(它可能是从操作系统或 Java 继承的)语言环境,例如):

                  I could alter my session, either directly with alter session or by ensuring my client is configured in a way that leads to the setting the string needs (it may be inherited from a operating system or Java locale, for example):

                  alter session set NLS_NUMERIC_CHARACTERS = ',.';
                  select to_number('100,12') from dual;
                  
                  TO_NUMBER('100,12')
                  -------------------
                               100,12 
                  

                  在 SQL Developer 中,您可以在 Tool->Preferences->Database->NLS 中设置您的首选值.

                  In SQL Developer you can set your preferred value in Tool->Preferences->Database->NLS.

                  但我也可以覆盖该会话设置作为查询的一部分,将可选的第三个 nlsparam 参数设置为 to_number();虽然这使得可选的第二个 fmt 参数也是必要的,因此您需要能够选择合适的格式:

                  But I can also override that session setting as part of the query, with the optional third nlsparam parameter to to_number(); though that makes the optional second fmt parameter necessary as well, so you'd need to be able pick a suitable format:

                  alter session set NLS_NUMERIC_CHARACTERS = '.,';
                  select to_number('100,12', '99999D99', 'NLS_NUMERIC_CHARACTERS='',.''')
                  from dual;
                  
                  TO_NUMBER('100,12','99999D99','NLS_NUMERIC_CHARACTERS='',.''')
                  --------------------------------------------------------------
                                                                          100.12 
                  

                  默认情况下,结果仍然与我的会话设置一起显示,所以小数点分隔符仍然是一个句点.

                  By default the result is still displayed with my session settings, so the decimal separator is still a period.

                  这篇关于NLS_NUMERIC_CHARACTERS 十进制设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 to_char 格式化间隔 下一篇:将 Unixtime 转换为日期时间 SQL (Oracle)

                  相关文章

                  <small id='pPiOc'></small><noframes id='pPiOc'>

                • <i id='pPiOc'><tr id='pPiOc'><dt id='pPiOc'><q id='pPiOc'><span id='pPiOc'><b id='pPiOc'><form id='pPiOc'><ins id='pPiOc'></ins><ul id='pPiOc'></ul><sub id='pPiOc'></sub></form><legend id='pPiOc'></legend><bdo id='pPiOc'><pre id='pPiOc'><center id='pPiOc'></center></pre></bdo></b><th id='pPiOc'></th></span></q></dt></tr></i><div id='pPiOc'><tfoot id='pPiOc'></tfoot><dl id='pPiOc'><fieldset id='pPiOc'></fieldset></dl></div>

                  <legend id='pPiOc'><style id='pPiOc'><dir id='pPiOc'><q id='pPiOc'></q></dir></style></legend>
                    <bdo id='pPiOc'></bdo><ul id='pPiOc'></ul>

                    <tfoot id='pPiOc'></tfoot>