Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Developer: Remove scientific notation from SQL Script output?

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.

like image 753
JoshKni8 Avatar asked Jan 29 '26 01:01

JoshKni8


1 Answers

Try using Cast to change it to a decimal

Cast([ColumnName] as decimal(38,0))
like image 112
anonymous Avatar answered Jan 30 '26 13:01

anonymous



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!