准备名称的陈述

时间:2019-05-08 20:07:31

标签: java sql

我有一个查询,但不确定是否应在查询中传递'?'。还是应该将其视为变量,并在语句本身中设置"b."+ name

Select x,y,z
FROM someTable
WHERE ....
UNION
SELECT a.x, a.y, a.z
FROM someTable a, someTable b
WHERE a.id = ? 
AND b.seq = a.seq
AND UPPER(b.?) // is this correct???
LIKE ?

如果我在该行上方更改为AND UPPER(?) 然后设置语句...

statement.setString(x, "b."+customString);

还是我应该这样做? AND UPPER(b.?)

statement.setString(x, customString); //or this?

结果是否相同?两种方式都存在意外行为吗?

0 个答案:

没有答案