Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Handling Currency in Database.

Re: Handling Currency in Database.

From: Thomas Kellerer <NNGNVRDSJEBN_at_spammotel.com>
Date: Wed, 17 Nov 2004 15:06:15 +0100
Message-ID: <30146nF2sc22sU1@uni-berlin.de>


On 17.11.2004 14:47 linevoltage_halogen wrote:

> Greetings All, I was hoping that someone might be able to offer some
> insight on how to handle currency both in a base table and within
> PL/SQL. My goal is to ensure that no rounding errors are introduced
> when moving these values around. I suspect that if I define an
> attribute as number(14,4) that all rounding errors will be avoided
> when doing arithmetic? Any help would be greatly appreciated.
>
> TFD
If you absolutely want to avoid rounding errors, then store your values as integers (= NUMBER(22)) and adjust the number when displaying.

Depending on the required accuracy you would then store your values as cents, 10th of a cent, 100th of a cent etc. and divide by the required factor when displaying the price.

Regards
Thomas Received on Wed Nov 17 2004 - 08:06:15 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US