Invalid data conversion: Parameter instance 50.0/100 is invalid for the requested conversion. ERRORCODE=-4461, SQLSTATE=42815

久未见 提交于 2019-12-08 13:03:28

Your parameterized query string should look like "whatever is in CHEMICAL_REORDERPOINT * (? / 100)", and you should set the percentage value using setDouble() or setFloat(), not as a String. Right now you are trying to tell DB2 to multiply whatever by a string, which doesn't make much sense.

If I had to guess I would say it is an auto conversion issue.

You had something like

5 * 50.0 / 100

and it worked.

No you have

50.0 / 100

and it fails.

It seems in the first it converted all operands to integers and in the second it converts them to floating point. But 100 is not a valid floating point constant. So change your new output to

50.0 / 100.0

or

50 / 100
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!