我在下面的查询中没有获得如何使用%?%的信息。这给了我错误:
PreparedStatementCallback; SQL的未分类SQLException [选择 *来自名称如'%?%']
的名称
问题:
String sql = "select * from names where name like ?";
List<NamesModel> names = jdbcTemplate.query(sql, new Object[]{searchName}, new NamesRowMapper());
答案 0 :(得分:0)
您的异常告诉您不能绑定到引用的值。下面将不起作用:
SELECT c.id,
c.coursename,
t.teachername,
s.studentname
FROM (SELECT id,
teachername,
row_number()
OVER(
partition BY id
ORDER BY id) AS teach
FROM table2)AS t
FULL JOIN(SELECT id,
studentname,
row_number()
OVER(
partition BY id
ORDER BY id) AS stud
FROM table3) AS s
ON( t.teach = s.stud
AND t.id = s.id )
RIGHT JOIN (SELECT id,
coursename
FROM table1) AS c
ON( c.id = s.id
OR c.id = t.id )
正确的方法是在 <link rel="stylesheet" type="text/css" href="./calc.css">
<script src="./calc.js"></script>
参数值周围添加String sql = "select * from names where name like '%?%'";
List<NamesModel> names = jdbcTemplate.query(sql,
new Object[]{ searchName }, new NamesRowMapper());
:
%