Subject Re: [IBO] Numeric Fields
Author Paul Schmidt
Geoff:


On 3 Mar 2001, at 12:37, Geoff Worboys wrote:

To: <IBObjects@yahoogroups.com>
Organization: Telesis Computing
From: "Geoff Worboys" <geoff@...>
Date sent: Sat, 3 Mar 2001 12:37:27 +1100
Send reply to: IBObjects@yahoogroups.com
Subject: Re: [IBO] Numeric Fields

> > DOLLAR_AMT NUMERIC(12,2) DEFAULT 0.0 NOT NULL;
> >
> > Plopped it on a form, and entered 1.46 the TDBEdit Control
> > came up with 9232374082633.6166 would much more reasonable.
> > I took a look at what actually got to IB and it says 0.
>
> What versions of everything? Particularly interbase version and
> dialect.

Here are the versions for everything

IB = Firebird 0.9.4.41
IBO = 3.6.Cf
Delphi = V3.0 (no patches applied)
Windows = 95A

Dialect is 3

> There is a bug in IB6 dialect 1 relating to numerics, but I believe
> you should only hit it when calculating with numeric(9,x) and lower.
> AFAICT the problem happens when the result of a calculation flows over
> from INT32 storage to double - that is; the result of the calculation
> is requires 10 or more digits, while the factors required only 9 or
> less digits.
> NUMERIC(6,2) * NUMERIC(6,2) gives NUMERIC(6,4)
>
> Also Jason made some changes relating to TIBO* stuff and numerics
> during one of the versions and there were some problem - not sure of
> the details.
>
>
> > My guess is this is some kind of conversion not getting done,
> > anyone know of a resolution other then a search for
> > NUMERIC(12,2) and replace with DOUBLE PRECISION and rebuilding
> > the database, it's not production so this is an option...
>
> Sounds to me like you should be using domains. Create a domain
> CURRENCY_D and define it as required - using it in the tables as
> required. You will still have to search trigger and procedure code to
> make changes, I add the domain name as a comment next to all
> parameter, returns and variable declarations to assist with this.

I guess I will have to read up about domains. Any ideas about where
I need to start? If I have to change them all anyway, maybe I'll
just make them all doubles and leave it alone....


Paul Schmidt,
Tricat Technologies
Email: paul@...
Website: www.tricattechnologies.com