有个模糊查询
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