ORA-01795:maximum number of expressions in a list is 1000. Any work around?
sarvanOct 14 2011 — edited Jan 11 2013I need some expert advice on wrting a query for this strange requirement.
This is my sample table, emp
Emp_id Emp_name
1 'ABC'
2 'DEF'
3 'GHI'
4 'XUD'
5 'EER'
6 'DDF'
7 'IOP'
8 'OPO'
9 'QWE'
select Emp_name from emp
where emp_id in ('1,2,6,8');
My real table has more than 5 million records.
In the list (1,2,6,8) that I'm adding here has 4 values, but typically it will have more than 1000 values.
When it is more than 1000 values, I'm getting this error nested exception is java.sql.SQLSyntaxErrorException: ORA-01795: maximum number of expressions in a list is 1000.
This is a query used in one of the application services and can be invoked by different users with different in-list.
So, the option for creating a table (temp table) for the in-list is not possible.
Any help is appreciated.
Regards,
Sarvan