I am trying to build an SQL query with around 100.000 given values.
For example:
Given values = [1, 2, 4, 5, 30, ...]
And I want to select all elements with an ID matching one of the elements.
I tried it like this:
SELECT x FROM y WHERE
someOtherColumn = 'test'
AND (
id = 1
OR id = 2
OR id = 4
OR id = 5
OR id = 30
-- ...
);
And like this:
SELECT x FROM y WHERE
someOtherColumn = 'test'
AND (
id IN (1, 2, 4, 5, 30, ...) --- 1000 values per IN clause
OR id IN (...)
-- ...
);
Both give me the same Error:
ORA-00913: Zu viele Werte
Is there another way to do this?