您的位置:首页 > 数据库 > Oracle

mybatis+oracle实现模糊查询

2018-03-15 23:11 471 查看
mybatis在mapper.xml中拼写sql本人感觉格式要求很严格,比如模糊查询使用like
<select id="selectStudent" parameterType="java.lang.String" resultType="com.Student">

-- 第一种 concat
select * from students where studentName like concat(#{studentName},'%')
--第二种 ||
select * from students where studentName like '%' || #{studentName} || '%'
</select>
在oracle中 concat不支持三个参数的 如concat('%',#{studentName},'%')
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: