I have a problem that only occurs in one part of a large system. On the first attempt to read a value from a DECIMAL(15,2) type column using the AsCurrency method of a TSQLQuery component a "EDataError - BCD overflow" exception is raised. Which particular row or table is being read from makes no difference. I cannot reproduce the problem in a small application. Any ideas?
Delphi 7.0
dbexpmda.dll 3.0.1.0
MySQL 5.0.18
BCD overflow
To reproduce this problem:
Create a table with one column called Amount of type DECIMAL(15,2)
Add one row to the table with 12.34 as the value for Amount
In Delphi set up TCRSQLConnection and TSQLQuery components
Call SQLQuery1.FieldByName('Amount').AsCurrency
If the TCRSQLConnection's FetchAll parameter is set to False a BCD Overflow exception should be raised. Using different values for Amount can result in 0 being returned rather than an exception being raised.
Create a table with one column called Amount of type DECIMAL(15,2)
Add one row to the table with 12.34 as the value for Amount
In Delphi set up TCRSQLConnection and TSQLQuery components
Call SQLQuery1.FieldByName('Amount').AsCurrency
If the TCRSQLConnection's FetchAll parameter is set to False a BCD Overflow exception should be raised. Using different values for Amount can result in 0 being returned rather than an exception being raised.