Print Thread
Typemismatch: expected Integer found Float (Oracle 12)
#52403 11/06/15 12:49 PM
Joined: Mar 2000
Posts: 8
Herdecke, NRW, Germany
S
Member
OP Offline
Member
S
Joined: Mar 2000
Posts: 8
Herdecke, NRW, Germany
I think this topic is related to
Typemismatch: expected Integer found Float (Oracle 11)
but also very strange.

Using Delphi XE8, DOA 4.1.3.5, DB 12.1.0.2.0, Client 11.2.0.1.0

I've created a simple table like this:
SQL Query
create table TESTTABLE
(
  test1 NUMBER(1),
  test2 NUMBER(1),
  test3 NUMBER(1)
);

And I've filled the table with some data:
SQL Query
INSERT INTO Testtable VALUES(1, 1, 1);
INSERT INTO Testtable VALUES(1, 1, 2);
INSERT INTO Testtable VALUES(1, 1, 3);
INSERT INTO Testtable VALUES(1, 2, 1);
INSERT INTO Testtable VALUES(1, 2, 2);
INSERT INTO Testtable VALUES(1, 2, 3);
COMMIT;

I've used a TOracleDataSet with this query:
SQL Query
SELECT test1, test2, COUNT(*) As Quantity 
  FROM Testtable 
 WHERE test1 = 1 
 GROUP BY test1, test2

With my old Oracle DB 10.2 the field 'test1' was for DOA of integer type, but now with Oracle DB 12.1 the field becomes of float type.
If I remove the WHERE clause or the GROUP BY (without COUNT), 'test1' will be recognized as an integer.
Do you know a reason for that behaviour?

Then I've put my query into a view (V_TEST) and run another query:
SQL Query
SELECT Data_Precision
  FROM User_Tab_Columns
 WHERE Table_Name = 'V_TEST'
   AND Column_Name = 'TEST1'
The result is 1.

But if I run the query as described in the related topic by coding:
Code
begin
  TestQuery.Execute;
  s := 'Precision = ' + IntToStr(TestQuery.FieldPrecision(0));
  s := s + ', Scale = ' + IntToStr(TestQuery.FieldScale(0));
  ShowMessage(s);
end;
The result for precision and scale is 0.

I know the workaround by changing the queries so that the fields will also become of type float in DB 10.2, but it's a lot of work. Perhaps you know a more simple way?

Best regards
Rolf

Re: Typemismatch: expected Integer found Float (Oracle 12)
Schlueter #52409 11/09/15 09:33 AM
Joined: Aug 1999
Posts: 22,204
Member
Offline
Member
Joined: Aug 1999
Posts: 22,204
Unfortunately there is no simpler way to fix this than modifying the queries.


Marco Kalter
Allround Automations
Re: Typemismatch: expected Integer found Float (Oracle 12)
Marco Kalter #53424 04/19/16 08:56 AM
Joined: Jul 2002
Posts: 71
R
Member
Offline
Member
R
Joined: Jul 2002
Posts: 71
Still no other way to tackle this?
We have a database with over 1000 of type number(1) fields.
It will take weeks for us to check all queries in our application.

Last edited by Ruudbern; 04/19/16 08:56 AM.
Re: Typemismatch: expected Integer found Float (Oracle 12)
Ruudbern #53426 04/19/16 09:56 AM
Joined: Aug 1999
Posts: 22,204
Member
Offline
Member
Joined: Aug 1999
Posts: 22,204
I'm not aware of any other option. But it may be possible to do an automated search of your .pas and .dfm files if you have a list of all number(1) columns.


Marco Kalter
Allround Automations
Re: Typemismatch: expected Integer found Float (Oracle 12)
Marco Kalter #53428 04/19/16 10:09 AM
Joined: Jul 2002
Posts: 71
R
Member
Offline
Member
R
Joined: Jul 2002
Posts: 71
Hi Marco,

Thanks for the super fast reply.

It seems that multiplying the field by 1 in the where clause does the trick.
In the given example test1 changes to integer again:

SELECT test1, test2, COUNT(*) As Quantity
FROM Testtable
WHERE test1*1 = 1
GROUP BY test1, test2

i will try to do the automated search you suggested.

Last edited by Ruudbern; 04/19/16 10:10 AM.

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.107s Queries: 15 (0.053s) Memory: 2.5223 MB (Peak: 3.0380 MB) Data Comp: Off Server Time: 2024-04-26 05:12:08 UTC
Valid HTML 5 and Valid CSS