我有这样的查询
SELECT * FROM TABLEA WHERE MODULE = :moduleId AND
UPPER(NAME) LIKE UPPER('%sample''s%') AND ID = :userId;
我用''逃避上面的撇号。然后将上面的sql传递给...
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("userId", userId);
namedParameterJdbcOperations.queryForList(sql, paramMap, Long.class);
我收到了这个错误:
SQL状态[99999];错误代码[17041];索引:: 3处缺少IN或OUT参数;嵌套异常是java.sql.SQLException:在index :: 3
处缺少IN或OUT参数在查看日志时,我看到userId没有被替换为?
SELECT * FROM TABLEA WHERE MODULE = ?
AND UPPER(NAME) LIKE UPPER('%sample''s%') AND ID = :userId;