DB2 Error SQLERRMC:DECFLOAT... sometimes

Keith Engle picture Keith Engle · Sep 25, 2013 · Viewed 20.7k times · Source

This one really has me scratching my head. This statement:

SELECT CODE FROM CODES_TABLE WHERE STATUS = 0 AND PERCENT = 30

works just fine, but this one:

SELECT CODE FROM CODES_TABLE WHERE STATUS = 0 AND PERCENT = 20

Gives me the

DB2 SQL Error: SQLCODE=-420, SQLSTATE=22018, SQLERRMC=DECFLOAT, DRIVER=3.57.82

error message, which I understand indicates that the value for PERCENT is malformed. PERCENT has a type of DECIMAL. Anyone have any ideas? 10 also fails, but all numbers above 30 work fine.

Even better,

SELECT CODE FROM CODES_TABLE WHERE STATUS = 0 AND PERCENT < 31 AND PERCENT > 29 works just fine but

SELECT CODE FROM CODES_TABLE WHERE STATUS = 0 AND PERCENT < 21 AND PERCENT > 19

yields the same error

Answer