TYPE OF FIELDS IN A TORAQUERY

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
usuarioincorrecto
Posts: 18
Joined: Thu 28 Jun 2007 12:43

TYPE OF FIELDS IN A TORAQUERY

Post by usuarioincorrecto » Fri 24 Aug 2007 10:55

Dear Sirs;

Please, forgive my poor English grammar. I'll do my best.

We work with Oracle 10g and ODAC 6.10.1.10, with Direct property set to TRUE, to connect Oracle 10g directly, this is, without Oracle Client.

We also have a previous ODAC built (4.50.1.18), working with ORACLE 8i, but in local mode, this is WITH Oracle Client, also with Delphi 6.

The fact is that in a TOraQuery, when adding fields to the TOraQuery AT DESIGN TIME, the ODAC 4.50.1.18 when the Field in the Oracle Database has only 8 digits, takes fields directly as "TFloatField". :shock:

It does not work like this with ODAC 6.10.1.10. If we do that with ODAC 6.10.1.10, it takes the field as a "TIntegerField". :shock:

We are having problems because of this, because we prepared our application (TDBGrid, etc..) for TFloatField, the field it took at that moment.
It raises many errors, such as the TOraQuery expects a Integer value, and it has a TFloatField definition.

Why?. Do we have to change all our application, looking for TFloatFields and replace them to TIntegerFields ?

What fields have also changed their type definition with newer ODAC versions?

Thank you.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 27 Aug 2007 08:10

Possibly this problem occurs because you have changed the Oracle version. But it is not related to the ODAC version.
If you want TFloatFields to be created for NUMBER(8), you can set the IntegerPrecision variable from the OraClasses unit to 7 or a less value. You should assign the value to this variable in the initialization section of one of your program units.
Last edited by Plash on Thu 30 Aug 2007 07:28, edited 1 time in total.

usuarioincorrecto
Posts: 18
Joined: Thu 28 Jun 2007 12:43

I CONTINUE HAVING PROBLEMS WITH DATATYPES IN ORACLE

Post by usuarioincorrecto » Wed 29 Aug 2007 10:39

Hi again;

I have tried what you told me. It doesn't work.

The problem is not when you are at design time, and adding fields to a TOraQuery. It takes them ok, and works ok.
The problem is in the TOraQueries WE ALREADY HAVE, and with the DATA TYPE of the fields, made with previous ODAC built and Oracle 8i.

A month ago, we HAD Oracle 8i, and the TOraQuery interpretated NUMBER(8) as TFloatField.
Nowadays, we try to execute that Query, against Oracle 10g and with ODAC 6.10.1.10, in DIRECT MODE, and it fails.
Delphi Raises an exception. Expecting FLOAT, actual:INTEGER.
Field in a DataBase: NUMBER (8).

If we build a project and we try to add all fields, it WORKS OK against Oracle 10g, with and without Oracle Client.

THE PROBLEM is when we have to execute a TOraQuery that was BUILT with Oracle8i and ODAC 4.50.1.18, because the TOraQuery took NUMBER (8) as TFloatField and nowadays, it takes this kind of fields as TIntegerField.
New TOraQuery, are OK. We addapt to the type of field ODAC give us.
But, what do we do with TQuerys made with a previous ODAC built?.


If I connect with ODAC 6.10.1.10 to a 8i Database, in DIRECT MODE, it works OK.
If fails when connecting to a 10g Database.

We have asked our DBA, and he is as surprised as us. He has searched for this error, and haven't found anything about this.

I have seen that there exists some POSTS in this Forum, attending to this item, attending to Oracle Data Type.

Please... can you make this proof?.

You can see the problem if you do this. Make a project with:

- DELPHI 6
- ODAC 4.50.1.18
- ORACLE 8i - A TABLE WITH SOME FIELDS : NUMBER(1) TO NUMBER(12).
- TAKE A TORAQUERY, AND ADD A FIELD WITH NUMBER(8) - NUMBER (9) --> IT APPEARS AS TFloatField in the TOraQuery

Now, the same, but with ODAC 6.10.1.10, and ORACLE 10g. Take the SAME field NUMBER(8).

--> IT APPEARS AS TIntegerField in the TOraQuery


Are you sure it's fixed? Are you sure there's not exist any bug with this?.


Thank you.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 30 Aug 2007 08:03

You can use this code to TFloatField be created for all NUMBER fields:

Code: Select all

initialization
  IntegerPrecision := 0;
end.
But in this case new TOraQuery components with TIntegerField will not work. To make work old and new TOraQuery components, you should recreate fields in old components and not set IntegerPrecision.

usuarioincorrecto
Posts: 18
Joined: Thu 28 Jun 2007 12:43

FIXED

Post by usuarioincorrecto » Fri 31 Aug 2007 06:05

Hi again;

Well. Finally we had to recreate the fields attending to the new ODAC components to work against Oracle 10g in Direct Mode.
You were right when you told me that number types in Oracle 10g might changed. :?
The fact is that there have been changes since Oracle 8.1.7 to 10g in this way, attending to the Data Type of number fields. You can find it in many forums and in the Oracle documentation.
This Oracle change affects the precision of all the fields defined as Number, with no precision, in the DataBase.

Thank you again.

Best regards.

Post Reply