Page 1 of 1

TOraQuery, Unicode and FieldsAsString

Posted: Mon 29 Jun 2009 20:57
by MarkF
It looks like the return data buffer size for numbers may be sized too small when FieldsAsString is true and Unicode is turned on. In some cases I get an "Ora-01406" error and in other cases the returned string seems to be cut short without an error message.

I haven't nailed it down completely yet, but one example is the following script. The query should show '-1', but it will only show '-':

Code: Select all

create table x (x number(1));
insert into x values (-1);
select * from x;
This isn't the only case though. If I have a function that returns a number, if the number is large, the value gets truncated. Please let me know if you need more info and I'll try to make a better test case!

Thanks.

Posted: Tue 30 Jun 2009 10:50
by Plash
We have increased the field size by one character to hold the sign. The fix will be included in the next ODAC build.

Please provide us an example for a function that returns a number.

Posted: Tue 30 Jun 2009 11:03
by MarkF
Thanks! It looks to me as though the default lengths for a number aren't enough (even adding 1). If you select a really big number like:

Code: Select all

select (1e80+2e70+3e60+4e50+5e40+6e30+7e20+8e10+9e0) "BigNum" from dual;
The current version will give you:
10000000002000000000300000000040000000

If you expand the return buffer, you'll see that Oracle actually sends the correct result:
100000000020000000003000000000400000000000000000000000000000000000000000000000000

It looks like the existing code assumes that the largest regular number would be 38 digits or so.

Posted: Tue 30 Jun 2009 11:34
by Plash
In the next build we'll change the field size for NUMBER to 132 because the maximum exponent for NUMBER is 130.

Posted: Tue 30 Jun 2009 14:39
by MarkF
Thanks!