SELECT DISTINCT ((CASE WHEN "'Master by Reseller$'"."Tier" IN ( '(blank)', 'Domestic Distributor', 'End-User', 'Evaluation', 'New') THEN '(blank)' ELSE "'Master by Reseller$'"."Tier" END)) AS "Tier (group)"
FROM "'Master by Reseller$'"
ORDER BY 1 ASC
The XSQLDA structure comes back from isc_dsql_describe with a single record having a length of 0x01c. We multiply this by 4 to make sure we allocate enough space. for the returning string. We then call isc_dsql_execute and isc_dsql_fetch. The isc_dsql_fetch call fails with:
arithmetic exception, numeric overflow, or string truncation
Adding the string 'Approved' to the IN list in the query seems to solve the problem. Most notably, it reduces the maximum length of the return string to be less than '(blank)'.
The problem does not reproduce with the UTF8 character set.