Page 1 of 1

Problem with IntegerPrecision in the OraClasses.pas module

Posted: Thu 19 Jul 2012 15:49
by StanislawS
Hello!

Upon migrate from BDE to ODAC there was the following problem. Fields of tables which in ORACLE 10g are defined as NUMBER (10) in Delphi5 with BDE 5.2 are defined as TIntegerField, but with ODAC 7.00.0.3 - as TFloatField. According to FAQ, we changed the value for IntegerPrecision = 10 in the OraClasses.pas module. Didn't help. As before, ODAC maps Oracle NUMBER (10) to TFloatField. Reinstalled ODAC. Didn't help too. What it is a problem and what is possible to make in our case?

Thank You!

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Fri 20 Jul 2012 09:03
by AlexP
hello,

The value of this variable should be set before connection, in this case, the fields with Precision less then the variable value will be determined as TIntegerField.
In There is a new functionality in the new ODAC version 8.2.7 - Data Type Mapping, that allows to set up mapping of all DB field types to any supported Delphi types in both design and run time.

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Fri 20 Jul 2012 14:22
by StanislawS
Thank you very much for the help and for a quickly reply.

So, the problem consists that the value of Precision should be LESS, instead LESS OR EQUAL, than the value of IntegerPrecision as it is specified in the FAQ. We have increased IntegerPrecision to 11. And now, really, ODAC maps Oracle NUMBER (10) to TIntegerField.

Thank you for the help once again.

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Mon 23 Jul 2012 11:24
by AlexP
hello,

We have checked the behaviour of this global variable - everything works correctly like it is described in the help (LESS OR EQUAL). Please specify the exact version of your Oracle server, the server may return Precision fields incorrectly.

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Mon 23 Jul 2012 14:18
by StanislawS
Hallo,

We have Oracle Database 10g Enterprise Edition Release 10.2.0.4.0

Best regards

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Tue 24 Jul 2012 09:44
by AlexP
hello,

We have checked the behaviour when setting this variable - and NUMBER fields with precision LESS OR EQUAL to the IntegerPrecision variable value are defined as TIntegerField.
Please execute the following query to make sure that the server returns the correct Precision value for your field:

SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION
FROM ALL_TAB_COLUMNS
WHERE TABLE_NAME = 'TABLE_NAME'
AND OWNER = 'SCHEMA_NAME'
AND COLUMN_NAME = 'COLUM_NNAME'

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Tue 24 Jul 2012 12:27
by StanislawS
Hello,

We have executed the query on several tables and any discrepancies didn't find. The server always returns the correct Precision value.

Thank you.

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Tue 24 Jul 2012 13:07
by AlexP
Hello,

Please try to create a new text table

Code: Select all

CREATE TABLE T_TEST
(
F_ID NUMBER(10)
);
and check the behaviour of IntegerPrecision variable on it, and inform us of the results.

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Wed 25 Jul 2012 10:09
by StanislawS
Hello,

For problem research we have created a small test table.

Code: Select all

CREATE TABLE T_TEST
(
F_ID09 NUMBER(9),
F_ID10 NUMBER(10),
F_ID11 NUMBER(11)
);
As a result of research it was determined that if fields are dynamically created by OraQuery then ODAC maps Oracle NUMBER (10) in full accordance with the criteria specified in documentation. But in Design Modus ODAC maps the NUMBER fields incorrectly. As it was specified earlier, comparing occurs by criterion LESS, instead of LESS OR EQUAL. And NUMBER (10) becomes TFloatField, instead TIntegerField.

Code: Select all

type
  TForm1 = class(TForm)
    OraQuery1: TOraQuery;
    DBGrid1: TDBGrid;
    OraSession1: TOraSession;
    OraDataSource1: TOraDataSource;
    BitBtn1: TBitBtn;
    OraQuery1F_ID09: TIntegerField;
>>>  OraQuery1F_ID10: TFloatField;  <<<
    OraQuery1F_ID11: TFloatField;

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Wed 25 Jul 2012 10:58
by AlexP
hello,

Setting local variable values will produce an effect only at run-time, and since persistent fields are created at design-time, then the value of this variable is 9 (the default value). Therefore your fields are created correctly. To change this behaviour, you should either edit our sources (if you have a source code version), or use Data Type Mapping to change field type in design-time.

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Wed 25 Jul 2012 14:40
by StanislawS
Hello,

OK, it is clear.

Thank you for the help.

Re: Problem with IntegerPrecision in the OraClasses.pas module

Posted: Thu 26 Jul 2012 13:11
by AlexP
hello,

If you have any other questions, feel free to contact us.