So I have roughly 200 SQL statements which will perform summations on various tables. I am running these summations as a script through SQL developer. I wish to compare the results of these summations across different databases.
所以我有大约200个SQL语句,它们将对各种表执行求和。我通过SQL开发人员将这些摘要作为脚本运行。我希望比较不同数据库中这些总结的结果。
The problem I am running into is that some of my summations result in scientific notation since the result is so big. This will not work for my comparison purposes as precision will be important.
我遇到的问题是,由于结果如此之大,我的一些总结会产生科学记数法。这对我的比较目的不起作用,因为精度很重要。
Here is an example summation query:
这是一个示例求和查询:
select sum(COLUMN_A), count(*) from TABLE_A;
Example output:
SUM(COLUMN_A) COUNT(*)
---------------- ----------
3.7E+12 68
So my question is is there some sort of setting which I could enable to display the entire numbers as opposed to scientific notation? I understand I can likely format the number from within the SQL itself, but that would be incredibly tedious.
所以我的问题是,是否有某种设置可以显示整个数字而不是科学记数法?我理解我可能会在SQL本身内格式化数字,但这将非常繁琐。
If the only way to do this would be to manually cast each summation, can you please provide a query which would work for a sum. When I attempted
如果执行此操作的唯一方法是手动转换每个求和,请提供一个可用于求和的查询。当我尝试
select to_char(sum(columnA), '9990.9999999999999999999'), count(*) from columnA;
it didn't work.
它不起作用。
1 个解决方案
#1
1
Try using Cast to change it to a decimal
尝试使用Cast将其更改为小数
Cast([ColumnName] as decimal(38,0))
#1
1
Try using Cast to change it to a decimal
尝试使用Cast将其更改为小数
Cast([ColumnName] as decimal(38,0))