| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Handling Currency in Database.
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
![]() |
![]() |