On oracle there is a limitation of maximum number of expressions in a list,
which means it is not possible to have a IN expression with more then 1000 entries.
Workaround would be to split the IN Expression and combine them with an or OR use a
Or to delete in batches.
The specific bug on the engine is to delete a deployment that contains for example a decision definition with more than 1000 historic decision instances.
This bug exist also for normal activity instances, case instances etc.
Results in ORA-01795: maximum number of expressions in a list is 1000.
Maybe it is possible to avoid the IN expressions in general.
Note: We have to fix all deleteHistoric*By*Ids statements which contains IN expressions