Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Oracle exception - "maximum number of expressions in a list is 1000"

I am passing a list of Strings to my query(SQL query written) to fetch the required data. But I am getting this exception:

ora-01795 maximum number of expressions in a list is 1000

I checked that I have more than 1000 entries in the list passed to the query IN parameter.

like image 755
Anand Avatar asked Mar 19 '12 09:03

Anand


People also ask

How do you solve the ORA-01795 maximum number of expressions in a list is 1000?

This ORA-01795 errors are related with More than 254 columns or expressions were specified in a list. You should remove some of the expressions from the list. To solve this error, Use the “UNION” clause to join together two separate queries and make it appear like a single result table.

What is ORA-01795?

ORA-01795: maximum number of expressions in a list is 1000 Error When Associating more than 1000 Inventory Groups to an Entity.

How do I fetch more than 1000 records in SQL?

To query more than 1000 rows, there are two ways to go about this. Use the '$offset=' parameter by setting it to 1000 increments which will allow you to page through the entire dataset 1000 rows at a time. Another way is to use the '$limit=' parameter which will set a limit on how much you query from a dataset.


1 Answers

this is a oracle limitation in the number of list pass in the query.

  1. you will have to chop your query or
  2. provide a subquery/join in the IN clause instead.
like image 68
digitebs Avatar answered Sep 20 '22 04:09

digitebs