I think you will need to cast to something like DECIMAL(20,2) i.e. specify
the precision and scale

On Thu, 7 Apr 2022 at 21:49, Jane <[email protected]> wrote:

> Hi All,
>
> I am upgrading H2 from 1.4.197 to 2.1.210. I have a query which casts a
> value to DECIMAL, as - SELECT AVG(CAST(A AS DECIMAL). Column A is INTEGER.
>
>  In older H2, this used to produce a value like 10002.5 and in 2.1.210,
> the same query produces 10002.0. What's happening internally here? Is there
> anything I can do to make this behave like in 1.0?
>
> The same query is being used across multiple databases (oracle, Postgres
> etc). That is why.
>
> Thanks,
> J.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/h2-database/66a79014-70be-47c6-9f16-7d3328a269a4n%40googlegroups.com
> <https://groups.google.com/d/msgid/h2-database/66a79014-70be-47c6-9f16-7d3328a269a4n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/CAFYHVnXkxsCy8_m9hNs%3DJv48H%2BOSFwvUFG%2Btehg4D9hTfnJ7sA%40mail.gmail.com.

Reply via email to