Subject Re: [IBO] Problem with filed DECIMAL(15,3)
Author Helen Borrie
At 07:00 AM 14-09-01 +0000, you wrote:

>I have a big problem with field DECIMAL(15,3)
>
>CREATE TABLE "TEST" (
> "ID" INTEGER NOT NULL PRIMARY KEY,
> "WEIGHT" DECIMAL(15, 3) ,
>);
>
>
>I use IBO 4.2. and IB6 and Delphi 5
>
>I use IBOTable with PessimisticLock = TRUE and I have this problem:
>
>I use one IB_Connection, one IBOTable, one DbGrig.
>
>Source
>
> IboTable1.PessimisticLock := TRUE;
> IboTable1.Open;
> IboTable1.Edit;
> IboTable1.FieldByName('WEIGHT').AsInteger := 99999,999; // OK
> IboTable1.Post;
> //
> IboTable1.Edit;
> IboTable1.FieldByName('WEIGHT').AsInteger := 9999999,999; // OK
> IboTable1.Post;
> //
> IboTable1.Edit;
> IboTable1.FieldByName('WEIGHT').AsInteger := 99999999,999; // ERROR
> IboTable1.Post;
>
>
>With I have this problem ????
>
>I try with IbConsole - Interactive SQL and don't have this problem ?
>Why ????
>
>
>Someone has ideas....

The Integer type in Delphi is signed 32-bit, so it has a maximum value of 2147483647. You error is thrown when you try to cast your scaled numeric to be an integer greater than this.

Unless you have a special reason to cast this large scaled numeric to integer, cast it AsFloat. Native IBO also has AsExtended, which gives better precision, but unfortunately it is not available to the TDataset field objects.

Cheers,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________