db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacopo Cappellato <...@sastau.it>
Subject Re: DerbyDB truncates the values inserted in a numeric field instead of approximating them
Date Fri, 03 Feb 2006 15:39:20 GMT

Daniel John Debrunner wrote:
> DECIMAL and NUMERIC are the same in Derby. So it looks like you are
> using the correct type. One option is to increase the scale of the
> number (digits after the decimal point), e.g. NUMERIC(20,4) which would
> then hold two extra digits that would be lost in the assignment to
> NUMERIC(18.2). Maybe this is what you meant by approximation, the
> ability to control the rounding as Dag said?

Yes, exactly (and sorry for my bad English).
Right now, we are not using (in general) the NUMERIC(20,4) approach to 
avoid having to deal with amount rounding in the code... just leaving to 
the db this task.
But in order to do this correctly with all the dbs we need to control 
the rounding algorithm of the db. If, as pointed out by Dag, this is not 
covered by the SQL spec, we'll have to cahnge this approach.



> Dan.
> [
> The SQL standard allows DECIMAL (I think) to have greater precision than
> defined while NUMERIC must match its defined precision.
> ]

View raw message