If I add all fields to a TUniQuery (in design time) this field generates TLargeintField on Delphi side, which is fine.
The problem is when I make a PIPELINED function using a TYPE with a NUMBER(18, 0) field that gonna create a TFloatField type instead of TLargeintField.
Here is the code I tested with:
Code: Select all
create table MY_TABLE (ID_FIELD NUMBER(18, 0));
insert into MY_TABLE values (42);
create type MY_OBJECT is object (ID_FIELD NUMBER(18, 0));
create type MY_OBJECT_TBL is table of MY_OBJECT;
create function SELECT_AS_OBJECT return MY_OBJECT_TBL pipelined as
begin
for v_rec in (select * from MY_TABLE)
loop
pipe row(MY_OBJECT(v_rec.id_field));
end loop;
end;
/
create package MY_PACKAGE is
type MY_RECORD is record (ID_FIELD MY_TABLE.ID_FIELD%TYPE);
type MY_RECORD_TBL is table of MY_RECORD;
function SELECT_AS_RECORD return MY_RECORD_TBL pipelined;
end;
/
create or replace package body MY_PACKAGE is
function SELECT_AS_RECORD return MY_RECORD_TBL pipelined as
begin
for v_rec in (select * from MY_TABLE)
loop
pipe row(MY_RECORD(v_rec.id_field));
end loop;
end;
end;
/
Code: Select all
select * from MY_TABLE;
-- this genereates TLargeintField, as expected
select * from table(SELECT_AS_OBJECT);
select * from table(MY_PACKAGE.SELECT_AS_RECORD);
-- these two genereates TFloatField, which is incorrect
[2] - The Oracle provider maps the NUMBER data type with different precision and scale to certain Delphi types depending on the provider options in the following way:
if scale equals zero, provider checks values of the specific options to choose the correct Delphi type in the following order:
1.1 field precision is less or equal PrecisionSmallint (default is 4) - uses ftSmallint;
1.2 field precision is less or equal PrecisionInteger (default is 9) - uses ftInteger;
1.3 field precision is less or equal PrecisionLargeInt (default is 18) - uses ftLargeint;