“Type Name Is Invalid” reported accessing DECIMAL / BCD field
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.
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.
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.