TOraSession.EnableNumbers side effects?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Alainxxyy

TOraSession.EnableNumbers side effects?

Post by Alainxxyy » Wed 02 Aug 2006 08:25

I am using odac 5.55.1.26 with bcb6 (windows xp pro sp2).
TOraSession.Net option is false.
I connect to oracle 10.2.0.1.0 on linux.
I encounter side effects when enabling TOraSession.EnableNumbers. Number fields are sometimes considered as strings.

1. First side effect:
I have the following oracle function:
function QTSTOCK (IPRODUCT NUMBER, ISITE NUMBER, DDT DATE, SSITE NUMBER /* DEFAULTED */, MUSTBECHARIOT CHAR /* DEFAULTED */, PREALONLY CHAR /* DEFAULTED */) return NUMBER;

I have the following SELECT in a quick report:
SELECT DISTINCT B.REFERENCE, B.REFERENCE,
QTSTOCK(B.PRODUCT,B.SITE, SYSDATE) AS QUANTITY
FROM CEC.VSTOCKQUANTITY B
ORDER BY B.REFERENCE

The report layout is
------------------------------------
| group header |
------------------------------------
| detail |
| QUANTITY |
------------------------------------
| group footer |
| TQRExpr=SUM(QUANTITY) |
------------------------------------

The function and the select work, but SUM(QUANTITY) is always blank if TOraSession.EnableNumbers is true,
and is right if TOraSession.EnableNumbers is false. :shock:
This happens because quantity is an alias to a function result, summing on a NUMBER column in a group works.

**********************************************************

2. Second side effect:
I have a the following SELECT in a CRDBGrid (oracle pivot):
SELECT * FROM (select joblist, filename, dtarrival ,
sum(case when asp.Col1='value1' then col2 else null end) as v1,
sum(case when asp.Col1='value2' then col2 else null end) as v2
from cec.batchgroups asp
group by joblist, filename, dtarrival)
order by 1 desc
v1 and v2 are NUMBERS as it is a sum on number columns


I have the following code:
TDataSet *m_DataSet=MyCRDBGrid->DataSource->DataSet;
TField * xField;
xField=MyCRDBGrid->Columns->Items[3]->Field;
m_DataSet->First();
if (!xField->IsNull)
if (xField->Value.Type()==varString || xField->Value.Type()==varOleStr)
ShowMessage ("this is a string");
else
ShowMessage ("this is not a string");

if TOraSession.EnableNumbers is true, "this is a string" is shown.
if TOraSession.EnableNumbers is false, "this is not a string" is shown. :shock:

However, I need the enableNumbers to set/get __int64 values in parameters.

Any Hint?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 03 Aug 2006 10:56

Value of TNumberField is returned as variant of type varString because this value cannot be represented as Integer or Double without loss of precision in case of numbers with large precision.
But to use Number parameters in your application you don't need to set EnableNumbers property of TOraSession component. So if you use Numbers only in parameters you can set EnableNumbers to False.

Post Reply