Reputation: 155
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.
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.
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.
Upvotes: 3
Views: 6588
Reputation: 113
Try using Cast to change it to a decimal
Cast([ColumnName] as decimal(38,0))
Upvotes: 3