ibatis中使用like模糊查询
2012-11-22 17:28
239 查看
无效的方法:
两种有效的方法: 1) 使用$代替#。此种方法就是去掉了类型检查,使用字符串连接,不过可能会有sql注入风险。
2) 使用连接符。不过不同的数据库中方式不同。
mysql:
oracle:
sql server:
select * from table1 where name like '%#name#%'
两种有效的方法: 1) 使用$代替#。此种方法就是去掉了类型检查,使用字符串连接,不过可能会有sql注入风险。
select * from table1 where name like '%$name$%'
2) 使用连接符。不过不同的数据库中方式不同。
mysql:
select * from table1 where name like concat('%', #name#, '%')
oracle:
select * from table1 where name like '%' || #name# || '%'
sql server:
select * from table1 where name like '%' + #name# + '%'
相关文章推荐
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- 【转】ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- ibatis中使用like模糊查询
- mysql中使用like模糊查询时如何转义%
- mysql中使用like模糊查询时如何转义%
- PreparedStatement 使用like 模糊查询
- PreparedStatement 使用like 模糊查询
- Mybatis中使用like模糊查询
- destoon系统中tag如何使用like与%来进行模糊查询