有个模糊查询
String sql = "select * from emp e where e.name like '?|%'";
Map<String, Object> map = jdbcTemplate.queryForMap(sql, new Object[] { empCode});
上面的写法不对,请问如何做转义?
认证0级讲师
转义后如下:
String sql = "select * from emp e where e.name like '?|/%' ESCAPE '/'";
网上有关模糊查询中特殊字符(下划线_,百分号%,方括号[],尖号^)的处理,可以搜索详细了解
String sql = "select * from emp e where e.name like ? ";Map; map = jdbcTemplate.queryForMap(sql, new Object[] { empCode});
转义后如下:
网上有关模糊查询中特殊字符(下划线_,百分号%,方括号[],尖号^)的处理,可以搜索详细了解
String sql = "select * from emp e where e.name like ? ";; map = jdbcTemplate.queryForMap(sql, new Object[] { empCode});
Map