“Type Name Is Invalid” reported accessing DECIMAL / BCD field

Issue

Crash Magic makes extensive use of Parameters in its SQL queries. This article describes how the program handles setting a parameter for DECIMAL or BCD fields.

Explanation

We’ve found that when setting a parameter of any type that compares against a DECIMAL/BCD field in a DB2 database, the DB2 engine seems to change the parameter type to BCD automatically.  A google search shows that this can be an issue in Informix as well.

The solution we’ve adopted for Crash Magic is to manually set the field type back from BCD to Float at the last moment before the query is executed.  This is not an ideal fix, and we’re not sure if it will be compatible with all systems in all cases, but it has worked in all the cases we’ve tried.

Solution

If you are a programmer wrestling with this, it took us a week to figure out this workaround.  Feel free to contact us for a more detailed description so you don’t have to spend a week on it too.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
How Can We Improve This Article?