I am trying to pass a list of integers in the IN
clause of a SQL Server JDBC query using Slick API for scala. The val stockIdsOfInterest
is a list of integers that I want to pass in the IN
clause. Here is my query:
val stockIdsOfInterest = gandalfIdToTickerMap.keys.take(2).toList // List[Int]
val ers = db.runSync(sql"""
SELECT
a.AttachmentID,
r.stock_id,
FROM
Attachment as a
JOIN
research r ON r.id = a.research_id
WHERE
r.stock_id in (${stockIdsOfInterest}) -- THIS CAUSES EXCEPTION
""".as[(Int, String, String, Int, Array[Byte], java.sql.Date)]
);
When I add the IN
clause, the query throws exception:
Error:(96, 39) not enough arguments for method implicitly: (implicit e: slick.jdbc.SetParameter[List[Int]])slick.jdbc.SetParameter[List[Int]].
Unspecified value parameter e.
val ers = db.runSync(sql"""
What am I missing?