Is there a workaround for
'ORA-01795: maximum number of expressions in a list is 1000 error'
I have a query and it is selecting fields based on the value of one field. I am using the in clause and there are 10000+ values
example:
select field1, field2, field3 from table1 where name in ( 'value1', 'value2', ... 'value10000+' );
Every time I execute the query I get the ORA-01795: maximum number of expressions in a list is 1000 error
. I am trying to execute the query in TOAD, no difference, the same error. How would I modify the query to get it to work?
Thanks in advance
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.
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.
Just use multiple in-clauses to get around this:
select field1, field2, field3 from table1 where name in ('value1', 'value2', ..., 'value999') or name in ('value1000', ..., 'value1999') or ...;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With