Print Thread
Page 1 of 2 1 2
Typemismatch: expected Integer found Float (Oracle 11)
#9832 04/24/08 01:28 PM
Joined: Nov 2006
Posts: 23
L
Member
OP Offline
Member
L
Joined: Nov 2006
Posts: 23
This problem somehow seems to be related to http://www.allroundautomations.com/ubb/ultimatebb.php?ubb=get_topic;f=1;t=002569

After adding a row via
Code
alter table T add (C number(1) default 0 not null);
and then trying to get this as integer, I'll always get a float back. This problem does only occur running a 11g db! Using 9i or 10g it works as expected.

By locating the problem, I also tried
Code
alter table T add (C number(1) default 0);
. Using this sql, I'll get an integer - as expected.

Also this problem seems to occur only, while adding a row to an already created and filled/ used table. While creating the table with "not NULL"-rows, I'll get an Integer.

But as you can imagine the "not Null"-option is essential for me.

So why is a here a float returned? Is it a bug in Oracle 11g or in the DOA - I think it's a bug.

Thanks in advance for any responds.

edit: Using newest DOA and Turbo Delphi 2006.

Re: Typemismatch: expected Integer found Float (Oracle 11)
#9833 04/24/08 03:07 PM
Joined: Aug 1999
Posts: 22,221
Member
Offline
Member
Joined: Aug 1999
Posts: 22,221
From your description it seems like an 11g bug. Direct Oracle Access derives the data type from the scale and precision as reported by the Oracle Server.

We'll check it out to see if we can reproduce this.


Marco Kalter
Allround Automations
Re: Typemismatch: expected Integer found Float (Oracle 11)
#9834 04/24/08 03:43 PM
Joined: Nov 2006
Posts: 23
L
Member
OP Offline
Member
L
Joined: Nov 2006
Posts: 23
Checking USER_TAB_COLUMNS the data_type, -precision and -scale, looks right.

TABLE_NAME COLUMN_NAME
------------------------------ ------------------------------
DATA_TYPE
--------------------------------------------------------------------------------

DATA_PRECISION DATA_SCALE N
-------------- ---------- -
VERTRAG_AKTEN KNDREGEL
NUMBER
1 0 N

Re: Typemismatch: expected Integer found Float (Oracle 11)
#9835 04/25/08 03:32 PM
Joined: Aug 1999
Posts: 22,221
Member
Offline
Member
Joined: Aug 1999
Posts: 22,221
Yes, but the question is what precision & scale the Oracle Client reports when this table is queried...


Marco Kalter
Allround Automations
Re: Typemismatch: expected Integer found Float (Oracle 11)
#9836 04/30/08 04:36 PM
Joined: Nov 2006
Posts: 23
L
Member
OP Offline
Member
L
Joined: Nov 2006
Posts: 23
Well, creating a small test-project with Ora-Session and Ora-Dataset, adding the field of interest to us, it is set to TFloatField. The ObjectInspector shows a Pricision of 15 and OracleDataSet1KNDREGEL.DataSize returns 8. What does this value indicates? What scale the OC returns I don't know how to find out.

Hope I could help you and am waiting for a possible solution.

Re: Typemismatch: expected Integer found Float (Oracle 11)
#9837 05/02/08 03:11 PM
Joined: Aug 1999
Posts: 22,221
Member
Offline
Member
Joined: Aug 1999
Posts: 22,221
Can you try the following? Create a TOracleQuery instance with the following SQL:

select <column> from <table>

where <table> is the name of the table with the number(1) column, and <column> is the column name. Next, run the following code:
Code
with TestQuery do
begin
  Execute;
  s := 'Precision = ' + IntToStr(FieldPrecision(0));
  s := s + ', Scale = ' + IntToStr(FieldScale(0));
  ShowMessage(s);
end;
Let me know what it says.


Marco Kalter
Allround Automations
Re: Typemismatch: expected Integer found Float (Oracle 11)
#9838 05/05/08 12:02 PM
Joined: Nov 2006
Posts: 23
L
Member
OP Offline
Member
L
Joined: Nov 2006
Posts: 23
Well, the result is this: 'Precision = 0, Scale = 0'

Strange, shouldn't precision be 1?

Re: Typemismatch: expected Integer found Float (Oracle 11)
#9839 05/05/08 12:31 PM
Joined: Nov 2006
Posts: 23
L
Member
OP Offline
Member
L
Joined: Nov 2006
Posts: 23
So, made some more test:
Code
alter table vertrag_akten add (TestRow1 number(1) default 0 not null);
alter table vertrag_akten add (TestRow3 number(1) default 1 not null);
alter table vertrag_akten add (TestRow2 number(1) default 0);
alter table vertrag_akten add (TestRow4 number(1) default 1);
alter table vertrag_akten add (TestRow5 number(2) default 0 not null);
alter table vertrag_akten add (TestRow6 number(2) default 0);
Results are:
'Precision = 0, Scale = 0'
'Precision = 0, Scale = 0'
'Precision = 1, Scale = 0'
'Precision = 1, Scale = 0'
'Precision = 0, Scale = 0'
'Precision = 2, Scale = 0'

So, as you can see, the problem is really the 'not null' statement.

Re: Typemismatch: expected Integer found Float (Oracle 11)
#9840 05/05/08 03:21 PM
Joined: Aug 1999
Posts: 22,221
Member
Offline
Member
Joined: Aug 1999
Posts: 22,221
Precision should indeed be 1. It seems like an Oracle bug.


Marco Kalter
Allround Automations
Re: Typemismatch: expected Integer found Float (Oracle 11)
#9841 05/05/08 06:54 PM
Joined: Nov 2006
Posts: 23
L
Member
OP Offline
Member
L
Joined: Nov 2006
Posts: 23
Is there any workaround other than not setting the field to not null? Because that wouldn't be the optimum.

Page 1 of 2 1 2

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.043s Queries: 14 (0.009s) Memory: 2.5615 MB (Peak: 3.0421 MB) Data Comp: Off Server Time: 2024-05-21 18:53:45 UTC
Valid HTML 5 and Valid CSS