Subject Re: [firebird-support] computed by columns
Author James
Hi Ivan

Ivan Prenosil wrote:

> What are definitions of your domains ? I guess
> D_MONEY and D_DISCOUNT_PERCENT are Numeric(x,2) ?
>
> In release notes for IB6 you can find some rules about arithmetic
> operations:
> "... If both operands are exact numeric, then multiplying or dividing
> the operands produces
> an exact numeric with a precision of 18 and a scale equal to the sum
> of the scales of the
> operands. ..."
>
> i.e. multiplying of four Numeric(x,2) values will produce
> Numeric(18,8) result.
>
>
> Also, what do you mean by "At first its data type was set at
> numeric(15,2),
> but after compiling it became numeric(18,8)" ? Did you use this syntax :
> CREATE TABLE INVOICE ( ...
> GRAND_TOTAL NUMERIC(15,2) COMPUTED BY ( ...
> ?
>
>
> Ivan
>
Since the Firebird behaves that way, are there some work around or do we
just leave it as is? What if I really want it to be numeric(15,20)?
Yes I use the syntax

CREATE TABLE INVOICE ( ...
GRAND_TOTAL NUMERIC(15,2) COMPUTED BY ( ...

but after compiling it the grand_total numeric(15,2) became
grand_total(18,8). You're right that both D_money and
d_discount_percent are numeric(x,2)


james