Blog

DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610, SQLERRMC=null

This was an interesting error I experienced. It didn’t happen in development, but it did on production. The SQL statement was something along these lines:

select 1 from catentry where partnumber = ucase(?)

After some debugging, I did find the answer to it. First off, this statement works perfectly fine in DB2 9.7 which was installed on development. However, in DB2 9.5, which was installed on production, or earlier, it does not work. You instead have to cast the parameter.

The fix is this:

select 1 from catentry where partnumber = ucase(? as varchar(64))

Contact us at contactus@zobristinc.com