Hello
ODAC 6.90.0.60+BDS2006
I am struggling in mapping of data among Float, Integer, LargeInt and Numbers, and always failed.
Image following Query:
select 1 as f1,
1.22 as f2,
1234567 as f3,
12345678901234567 as f4,
123456789012345678 as f5
from dual
And I expect that f1 be mapped into an Integer type, f2 for float, f3 for integer, f4 for integer, f5 for Largeint.
if I have set in the Orasession.Options as
EnableIntegers:=True;
EnableLargeint:=True;
EnableNumbers:=True;
Result: All files are mapped into ftNumbers.
if I set:
EnableIntegers:=True;
EnableLargeint:=True;
EnableNumbers:=False
then all the fields are mapped to ftFloat
It seems that the three Precisions:
IntegerPrecision,
LargeIntPrecision,
FloatPrecision
does not work?
Float, Integer, Largeint and Numbers
Hello
Oracle returns precision for all columns equal to 38. Any integer number with precision = 38 cannot be stored in the Delphi Integer type because it has size 32 bit. So ODAC creates TFloatFields for these columns. But you can change this behavior by defining SmallintPrecision, IntegerPrecision or LargeIntPrecision global variables in the OraClasses unit.
The sample:
In this sample all fields will be created as TLargeIntField.
Oracle returns precision for all columns equal to 38. Any integer number with precision = 38 cannot be stored in the Delphi Integer type because it has size 32 bit. So ODAC creates TFloatFields for these columns. But you can change this behavior by defining SmallintPrecision, IntegerPrecision or LargeIntPrecision global variables in the OraClasses unit.
The sample:
Code: Select all
begin
LargeIntPrecision := 38;
OraQuery1.SQL.Text := 'select 1 as f1, ' + #13 +
'1.22 as f2, ' + #13 +
'1234567 as f3, ' + #13 +
'12345678901234567 as f4, ' + #13 +
'123456789012345678 as f5 ' + #13 +
'from dual ';
OraQuery1.Open;
Memo1.Clear;
for i := 0 to OraQuery1.FieldCount - 1 do
Memo1.Lines.Add(OraQuery1.Fields[i].ClassName);
end;