Skip to Content
2

Select 0-.75 from system.iota - returns wrong results

Jan 19, 2017 at 05:47 PM

127

avatar image

SQL statment "Select 0-.75 from system.iota"

In previous versions it correctly returned -0.75.

In version 12 it returns 9.75

10 |10000 characters needed characters left characters exceeded

Nice bug... I did some testing and got this:
With

declare foo integer;
set foo = 0;
select foo-0.75 from system.iota

you get 9.25 as result. But if you declare "foo" as double, ADS does it right. Maybe this helps development to pinpoint this bug. Btw, how did you find it?

1
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Ben Ben Feb 07, 2017 at 06:02 PM
0

We came across this by customers complaining that wrong info is showing for customer's balances.

The balances at that table were being pushed thru an After Update Trigger on a different database, where to avoid null values the current value is concatenated into a SQL statement by doing something like:

Execute Immediate 'Update TargetTable Set TargetField=0'+Cast(__New.Balance AS SQL_VARCHAR)+' Where CustID='''+Cast(__New.CustID AS SQL_VARCHAR)+''';';

It turned out that whenever customer balance was below zero the wrong information is posted.

It would've been a "NICE BUG" if this would be just an academic testing field. Problem is that SAP is dealing it in this manner.

Opened a support ticket, only to have to proof it's a bug and be told in the end "This incident is being forwarded along for development to look into next."

Share
10 |10000 characters needed characters left characters exceeded