---
title: "ibatis模糊查询"
author: "j2ee_yohn"
date: "2009-05-27T11:57:29Z"
tags: []
categories: ["企业架构"]
slug: "ibatis"
draft: false
lastmod: "2009-05-27T11:57:29Z"
id: 397168
url: "https://j2ee-yohn.iteye.com/blog/397168"
---

为了防止SQL注入,ibatis使用模糊查询时也要避免使用$$来进行传值.下面是三个不同数据库的ibatis的模糊查询传值

 

mysql: select * from stu where name like concat('%',#name #,'%')

oracle: select * from stu where name like '%'||#name #||'%'

SQL Server:select * from stu where name like '%'+#name #+'% 这个还没测试