我正在执行查询,
SELECT
UNIQUE PXCID,SNCID,FREQUENCY
FROM
AFFECTEDXCS
WHERE
PTPNAME IN ('AM2125A-1-14-LINEIN','AM2125A-1-15-LINEOUT','CWR-7-14-CLS2')
AND FREQUENCY='9170' and NENAME='CP0MP1-121-N2-SITE3'
ORDER BY SNCID;
从SQL Developer ,它给了我一行值?
相同的查询我正在尝试使用代码从java执行它。
String query = DBStatements.PXCID_LIST;
Object[] param = new Object[3];
param[0]="AM2125A-1-14-LINEIN,AM2125A-1-15-LINEOUT,CWR-7-14-CLS2";
param[1]=frequency;
param[2]=nodelabel;
List<Map<String,Object>> returnList = eqmqueryexec.executeQuery(EQMDataSource.OTN, "0", query, param);
Iterator<Map<String,Object>> iter = returnList.iterator();
logger.debug("iterator bolean length"+iter.hasNext());
我将“iterator bolean length”视为false。那意味着查询没有正确执行?
答案 0 :(得分:0)
你需要与IN子句绑定的每个参数都应该是单独的问号而不是一个问题。标记整个IN子句..比如
SELECT * FROM employees WHERE emp_id IN(?,?,?,?,?)
你必须分别为每个param绑定变量..