Number and Double

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kesrt
Posts: 2
Joined: Tue 17 Jul 2012 04:53

Number and Double

Post by kesrt » Tue 17 Jul 2012 05:18

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?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Number and Double

Post by AlexP » Tue 17 Jul 2012 09:18

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.

kesrt
Posts: 2
Joined: Tue 17 Jul 2012 04:53

Re: Number and Double

Post by kesrt » Tue 17 Jul 2012 09:44

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Number and Double

Post by AlexP » Tue 17 Jul 2012 11:08

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

Post Reply