简体   繁体   English

如何在 Oracle SQL Developer 中永久配置数字格式?

[英]How to permanently configure number format in Oracle SQL Developer?

I am writing some queries in Oracle SQL Developer with numbers that have many digits.我正在 Oracle SQL Developer 中写一些查询,其中的数字有很多。 It would be really helpful if in general, all numbers had the thousands separator standard with no decimals.如果一般来说,所有数字都具有没有小数的千位分隔符标准,那将非常有帮助。

The current default setting is: 999999999999,00当前默认设置为: 999999999999,00

I would like this setting: 999.999.999.999我想要这个设置: 999.999.999.999

(European group and decimal separator) (欧洲组和小数分隔符)

I know that I can change the format of numbers using to_char, and possibly other functions.我知道我可以使用 to_char 以及可能的其他函数来更改数字的格式。

But I do not want to have to add a function for each field in the select statement.但我不想为 select 语句中的每个字段添加 function。 I want to know how to just change the default number setting in Oracle SQL developer and have this format used for all queries.我想知道如何更改 Oracle SQL 开发人员中的默认数字设置,并将此格式用于所有查询。

have this format used for all queries.将此格式用于所有查询。

If you mean format all queries you run in SQL Developer it's super easy.如果您的意思是格式化您在 SQL Developer 中运行的所有查询,这非常容易。

The NLS Settings are controlled by the SQL Developer preferences sub-menu. NLS 设置由 SQL 开发者首选项子菜单控制。 The location of this varies;它的位置各不相同; because I use a Mac for me it's on the Oracle SQL Developer menu but if you use Windows I think you'll find it on the Tools menu.因为我使用的是 Mac,它位于 Oracle SQL 开发人员菜单上,但如果您使用 Windows,我想您会在工具菜单上找到它。

Anyway, the path is Preferences -> Database -> NLS.无论如何,路径是 Preferences -> Database -> NLS。 Then you can set the Decimal Separator and Group Separator:然后您可以设置小数分隔符和组分隔符:

SQL Developer NLS 窗口的屏幕截图


Hmmmm, just re-read your post, and realised I may have missed the point.嗯,只是重新阅读您的帖子,并意识到我可能错过了重点。

all numbers had the thousands separator standard with no decimals.所有数字都有千位分隔符标准,没有小数。

We can't not have a decimal separator.我们不能没有小数点分隔符。 Oracle will default it to the default separator for the NLS Territory if nothing is specified (not sure if this is documented behaviour).如果未指定任何内容,Oracle 会将其默认为 NLS 区域的默认分隔符(不确定这是否是记录在案的行为)。 The only way to avoid it would be to obviate the need for a decimal separator and store only integers in the database - or round every number you select.避免它的唯一方法是消除对小数分隔符的需要并仅在数据库中存储整数 - 或将每个数字四舍五入 select。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM