0
的,我想做到以下幾點的Java + Oracle數據庫:如何查詢數據庫中的一組值
private List<Number> getIds(List<String> names) {
String query = "SELECT id FROM months WHERE name IN (?)";
...
}
我如何通過我的List<String> names
到「?」在上面的查詢中?我正在尋找一個動態的解決方案,因爲給定列表的大小會有所不同。
我正在使用Spring 3.0和Oracle 11.2.0.2。
謝謝。
可能重複http://stackoverflow.com/questions/4381791/how-do-you-write- -sql-for-a-prepared-statement-using-a-where-x-in-clause) – Thilo 2012-08-16 09:15:55
也http://stackoverflow.com/questions/178479/preparedstatement-in-clause-alternatives?lq=1 – Thilo 2012-08-16 09:16:56
爲什麼你不要使用jpa? – user902383 2012-08-16 09:18:52