When a TOracleDataSet interprets field as a TIntegerField?

Wenuz

Member
I need a Field to be of type otInteger. I have an SQL, eg.: 'select 1 from dual', and TDataSet treats field '1' as an otFloat type. When I force the integer type I get: "Type mismatch for field '1', expecting: Integer, actual: Float'.

Are there any properties or tricks I could set/use to get an integer field?
 
Direct Oracle Access treats all numbers with scale > 0 or precision > 9 as float fields. The database column of field in the select statement will determine the precision and scale.

If you use a function on a column, or if you select a literal value, Oracle will report a floating point field. Therefore, 'select 1 from dual' will result in a float field.

The TOracleSession.Preferences.IntegerPrecision will allow you to control the maximum precision that will be treated as an integer field. Set it to 39 (or higher) to treat all numbers with scale = 0 as integers.

------------------
Marco Kalter
Allround Automations
 
Thank you for this solution, it works fine.

Unfortunatelly I came across another but similar problem. There are situations in which I would like to specify the number of decimal characters kept in the field value. The sql is similar 'select 1.00 from dual'. Is it possible to edit this field in a data-aware component and automaticly have the two decimal format database value not only display value, eg. not 2.123 but 2.12 value? Or do I have to handle the OnPost event?
 
The same limitations as before apply: for functions and literal values the scale and precision are unknown.

If there is a scale and precision, you can set TOracleDataSet.OracleDictionary.DisplayFormats and RangeValues to True. As a result, the field's DisplayFormat, EditFormat, MinValue and MaxValue will dynamically be set in accordance with the scale and precision of the column.

------------------
Marco Kalter
Allround Automations
 
Back
Top