Subject Re: Max size of parameters to IN and NOT IN?
Author Svein Erling
--- In firebird-support@yahoogroups.com, "Robert DiFalco" wrote:
> For a prepared statement, or not I suppose, what is the maximum
> number of values I can use in an IN clause?
>
> For example:
>
> SELECT *
> FROM Foo
> WHERE Foo.id IN (1,2,3,4,5);

If you get problems with such a limit, you could work around it by
inserting the values into a table and change your query to

SELECT *
FROM Foo
WHERE EXISTS(SELECT * FROM ValuesList VL WHERE VL.Foo_id = Foo.id)

A quick solution that should work regardless of how many values you
have (well, within reasonable limits, I've never tried with more than
a few millions).

Set