Subject | RE: [ib-support] newbie question : NUMERIC and DECIMAL type diffe rence |
---|---|
Author | Wilson, Fred |
Post date | 2003-02-20T20:39:31Z |
We use INTEGER for all measurements. We have various rules tables, that
describe the unit of measurement for a particular column.
For instance, postage (which for the US Manifest is in US dollars).. The US
Manifest requires the postage to be to tens of a cent -> $000.001 ...
So the postage column in the Manifest table is defined as an INTEGER, and
the number of "units" in the column, when in the US is tens of a cent.
Likewise for mailpiece weight, the column is defined as an INTEGER.. The
rules table will say, that in the US, the units are tens of an ounce, etc.
This method works great on several different levels.
- Rounding "errors" are miniminzed.
- Internationalization is extremely easy, as a column could hold units
defined as, dollars, cents, tens of a cent, euro dollars, rands, ounces,
grams, pounds, hectares, square miles, yards, meters, millimeters, so on and
so forth.
Very easy, once the rules classes are implimented, and easily extendable.
Best regards,
Fred Wilson
SE, Böwe Bell & Howell
fred.wilson@...
-----Original Message-----
From: Brian K. Woods [mailto:brian@...]
Sent: Thursday, February 20, 2003 12:06 PM
To: ib-support@yahoogroups.com
Subject: RE: [ib-support] newbie question : NUMERIC and DECIMAL type
difference
Albert,
any issues concerning BigDecimal.
However, on the issue of which to use in general, I can only pass back
wisdom already imparted in this
forum on several occasions. Ann and/or Helen (I think Helen gives credit for
it to Ann) stated a rule of
thumb to use DECIMAL for things you "measure" and NUMERIC for things you
"count". I have adopted that
rule of thumb, and so far it has always worked out correctly in my financial
calculations, etc.
Since you "count" pennies, use NUMERIC for money. As an example, I have
taken to using NUMERIC(15,4),where
the 4 is because I use Delphi, which only uses four "cents" digits in its
currency calculations.
There are others with more experience than I who can correct me if I have
steered you wrong, esp.
pertaining to any issues with JDBC / BigDecimal.
HTH,
Brian
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
[Non-text portions of this message have been removed]
describe the unit of measurement for a particular column.
For instance, postage (which for the US Manifest is in US dollars).. The US
Manifest requires the postage to be to tens of a cent -> $000.001 ...
So the postage column in the Manifest table is defined as an INTEGER, and
the number of "units" in the column, when in the US is tens of a cent.
Likewise for mailpiece weight, the column is defined as an INTEGER.. The
rules table will say, that in the US, the units are tens of an ounce, etc.
This method works great on several different levels.
- Rounding "errors" are miniminzed.
- Internationalization is extremely easy, as a column could hold units
defined as, dollars, cents, tens of a cent, euro dollars, rands, ounces,
grams, pounds, hectares, square miles, yards, meters, millimeters, so on and
so forth.
Very easy, once the rules classes are implimented, and easily extendable.
Best regards,
Fred Wilson
SE, Böwe Bell & Howell
fred.wilson@...
-----Original Message-----
From: Brian K. Woods [mailto:brian@...]
Sent: Thursday, February 20, 2003 12:06 PM
To: ib-support@yahoogroups.com
Subject: RE: [ib-support] newbie question : NUMERIC and DECIMAL type
difference
Albert,
>I have not worked with JDBC, so, someone else will have to inform you of
> I'm using JayBird JDBC to access the tables, for financial calculation.
> It would be accessed into JDBC BigDecimal object.
>
> What would be the correct choice of data type ?
any issues concerning BigDecimal.
However, on the issue of which to use in general, I can only pass back
wisdom already imparted in this
forum on several occasions. Ann and/or Helen (I think Helen gives credit for
it to Ann) stated a rule of
thumb to use DECIMAL for things you "measure" and NUMERIC for things you
"count". I have adopted that
rule of thumb, and so far it has always worked out correctly in my financial
calculations, etc.
Since you "count" pennies, use NUMERIC for money. As an example, I have
taken to using NUMERIC(15,4),where
the 4 is because I use Delphi, which only uses four "cents" digits in its
currency calculations.
There are others with more experience than I who can correct me if I have
steered you wrong, esp.
pertaining to any issues with JDBC / BigDecimal.
HTH,
Brian
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
[Non-text portions of this message have been removed]