Page 1 of 1

How to pass a list of values to an IN operator?

Posted: 13.12.2023, 21:52
by shmorsecode
Hi everyone! This is my first post.

I've been wondering how would you pass a list of values given a query like this?

Code: Select all

SELECT * FROM MyTable T WHERE T.ID IN (:id_list)

Re: How to pass a list of values to an IN operator?

Posted: 15.12.2023, 10:53
by aehimself
Hello and welcome to the forum!

As far as I recall I saw array type in parameter values but I'm not sure if any protocols acutally support that. You can give that a try, that would be the best soltuion.
What should work however is multiple parameters, like

SELECT * FROM MyTable WHERE MyField IN (:pParam1, :pParam2, :pParam3 [...] )