Subject RE: [ib-support] 0 instead a number
Author Gerhardus Geldenhuis
I had a similar problem, but I was mixing integer
and double precision. The only way for me to remedy
that was to cast the integers and the result of every
calculation(*,/,-,+)to double precision. Maybe that is the
same problem, and you can try to cast all results as
numeric. I write a udf when I begin to do any complex
calculations mixing reals and ints I find it less error
phrone.
>
>
> Hi List.
>
> I have the following trigger in a table.
>
> CREATE TRIGGER PARCELLE_GARA_BU0 FOR PARCELLE_GARA
> BEFORE UPDATE POSITION 0
> as
> begin
> new.PERCENTUALE_MEDIA =
> ( ( new.PERCENTUALE_UNO - new.PERCENTUALE_DUE ) /
> ( new.IMPORTO_LAVORI_DUE - new.IMPORTO_LAVORI_UNO )) *
> ( ( new.IMPORTO_LAVORI_DUE - new.IMPORTO_LAVORI_MEDIO ) +
> new.PERCENTUALE_DUE );
> end;
>
> the Table Field type is as follow:
> PERCENTUALE_MEDIA is declared as numeric( 12,10 );
> Value:
> PERCENTUALE_UNO is declared as numeric( 12,10 );
> Value: 5.4386
> PERCENTUALE_DUE is declared as numeric( 12,10 );
> Value: 4.9614
> IMPORTO_LAVORI_DUE is declared as numeric( 18,2 );
> Value: 3.000.000.000
> IMPORTO_LAVORI_UNO is declared as numeric( 18,2 );
> Value: 2.000.000.000
> IMPORTO_LAVORI_MEDIO is declared as numeric( 18,2 );
> Value: 2.045.625.000
>