com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610, SQLERRMC=null时间:2023-03-10 00:20:18 写了一条sql,在db2数据库中可以执行,但是转换成mybatis的mapper文件后,在执行排序操作时报该错误。 我排序是这样写的 <if test="orderStr != null"> ORDER BY #{orderStr} </if> 看了一下其他地方的写法发现使用$,而不是#,改成如下就可以了 <if test="orderStr != null"> ORDER BY ${orderStr} </if>