Skip to Content

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

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

In previous versions it correctly returned -0.75.

In version 12 it returns 9.75

Add comment
10|10000 characters needed characters exceeded

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

    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?

  • Get RSS Feed

1 Answer

  • Feb 07, 2017 at 06:02 PM

    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."

    Add comment
    10|10000 characters needed characters exceeded