VarToBcd for value 0 issue
Original Reporter info from Mantis: s73
-
Reporter name: Vladimir K
Original Reporter info from Mantis: s73
- Reporter name: Vladimir K
Description:
VarToBcd returns for value 0 structure filled with 0 (Precision, SignSpecialPlaces and Fraction) while Delphi returns Precision 10 and SignSpecialPlaces 2. It looks insignificant until BCD value sent to ASE (Sybase) and fails with message "Domain error during implicit conversion of NUMERIC value '' to a DECIMAL field".
Steps to reproduce:
var
v: Variant;
bcd: TBcd;
begin
v := 0;
bcd := VarToBcd(v);
Additional information:
For now avoidable by fix after conversion
if (bcd.Precision = 0) and (bcd.SignSpecialPlaces = 0) then begin
bcd.Precision := 10;
bcd.SignSpecialPlaces := 2;
end;