Page 1 of 1

Number and Double

Posted: Tue 17 Jul 2012 05:18
by kesrt
Hello,

I'm using ODAC 8.0.1

create table aaa(inId NUMBER(1));
create view bbb as select max(inId) as "id" from aaa;
insert into aaa values(1);
insert into aaa values(2);
insert into aaa values(3);

create or replace procedure ccc (cr out SYS_REFCURSOR)
as
begin
open cr for select inid from aaa;
end;

create or replace procedure ddd (cr out SYS_REFCURSOR)
as
begin
open cr for select id from bbb;
end;

If I call ccc proc - I get long datatype which is correct.
INID = 1 = Long
----------------------------------------------
INID = 2 = Long
----------------------------------------------
INID = 3 = Long
----------------------------------------------


If I call ddd proc - I get double datatype which is INCORRECT.
id = 3 = Double

If there any way to get in a dataset the underlying type?

Re: Number and Double

Posted: Tue 17 Jul 2012 09:18
by AlexP
Hello,

This is the correct behaviour, since in this case Oracle returns the double type, this is due to the usage of the MAX aggregate funciton. In the new ODAC version 8.2.7, there was added a new functionality that allows to map database data types to any compatible Delphi data types. You can download the new version and set up DataTypeMapping for the necessary fields. There are examples of setting up mapping in the ODAC help.

Re: Number and Double

Posted: Tue 17 Jul 2012 09:44
by kesrt
Hello,

I've tried:
create view bbb as select inId as "id" from aaa;
I got:
id = 1 = Double
----------------------------------------------
id = 2 = Double
----------------------------------------------
id = 3 = Double
----------------------------------------------

I think it's not the aggregate function - it's a view issue.

How does TOraQuery determine the fields datatypes? Is it an OCI call?

Thanx.

Re: Number and Double

Posted: Tue 17 Jul 2012 11:08
by AlexP
hello,

After re-creating View without applying aggregate functions, the field type is defined correctly. The data type is returned by the Oracle server, and we define them with the help of the methods from the Oci.dll library