Unexpetced result when calculate with fields

48 views
Skip to first unread message

Rinse Lemstra

unread,
Aug 13, 2021, 8:53:06 AM8/13/21
to H2 Database
Hi,

For this test I use this table:

drop table if exists test;
create table test(minutes numeric(12,2));
insert into test values(1200);
select sum(minutes)/60 from test;

When I execute this I get as result 2E+1.

How can I get a more readable output?

Evgenij Ryazanov

unread,
Aug 15, 2021, 10:28:43 PM8/15/21
to H2 Database
Hello.

You can add a cast to REAL or DOUBLE PRECISION: cast(sum(minutes) / 60 as double precision).

Actually it's a bug, it was fixed after the last published release of H2. H2 compiled from current sources returns 20.0000000000000000000000 as expected.
Reply all
Reply to author
Forward
0 new messages