Subject Re: NUMERIC(18,6) calculation problem
Author Adam
--- In firebird-support@yahoogroups.com, Luis Madaleno <luis@...>
wrote:
>
> Hi,
>
> This seems not to work either:
>
> declare variable tmp NUMERIC(18,12);
> declare variable tmp1 NUMERIC(18,6);
> declare variable tmp2 NUMERIC(18,6);
> begin
> tmp1 = new.fld1;
> tmp2 = new.fld2;
> tmp = tmp1 * tmp2;

Did you mean here

new.fld3 = CAST(tmp AS NUMERIC(18,6));

> end;

If the problem is how Firebird handles intermediate results, and you
are using the tmp field that is large enough to hold these results to
get around this, then I assume tmp is what you meant to cast. You may
also want to try it without the new.fld3 line to see whether 18,12 is
large enough to fit the intermediate results.

I don't usually need to do this sort of thing, so I can't really be
of much more help.

Adam