如何逃避'&'动态在SQL中的WHERE子句中的文本中。我的数据库是Oracle。我正在尝试如下:
public List getBookingList( String searchText ){
String sql= " SELECT c.name FROM customer c WHERE c.name like ? " ;
List params = new ArrayList();
params.add("%"+searchText+"%");
// "searchText" may contain "&",Ex: A&B Beverage Ltd. How to search with it.
return jdbcTemplate.queryForList(sql,params.toArray());
}