Subject | RE: [firebird-support] Currency |
---|---|
Author | Steffen Heil |
Post date | 2004-04-05T17:41:24Z |
Hi
My problem lies beside the database. I need to get this information out of
the database and back into it.
And on the Java-side I do not want to handle all those rounding troubles.
Therefor I just define money as a lot of Cents.
Therefor currency fits very well into an ordinary INTEGER.
If I use NUMERIC or DECIMAL (wich are somehow stored as integers on the
database side), I need to get them as floats or doubles in Java out of the
JDBC connection. On that way, I get rounding troubles, I do NOT have, if I
use my approch with ints.
Regards,
Steffen
> > I use INTEGER, counted in Cent.Re-Read what I wrote:
> > (Anyway, the main reason is to be able to multiply and add them
> > without having to think about rounding, (as I do this in Java and
> > afaik Numeric and Double need to be taken as floats))
>
> This is not true. NUMERIC is a fixed-decimal datatype and not a float.
>
> Here is an exerpt from the Data Definition Guide:
> ...
>
> So one does not be afraid of NUMERIC as currency type.
My problem lies beside the database. I need to get this information out of
the database and back into it.
And on the Java-side I do not want to handle all those rounding troubles.
Therefor I just define money as a lot of Cents.
Therefor currency fits very well into an ordinary INTEGER.
If I use NUMERIC or DECIMAL (wich are somehow stored as integers on the
database side), I need to get them as floats or doubles in Java out of the
JDBC connection. On that way, I get rounding troubles, I do NOT have, if I
use my approch with ints.
Regards,
Steffen