Harish
Harish

Reputation: 1647

SQLException in JDBC

I am getting a SQLException when I try to run the query in Informix DB using JDBC. The query is huge in size:

select * table_name where tableid in (....)

I get an exception because the 'in' part contain more than 5000 values and because of the length. Is there a way to avoid this or should I break it down and run two queries?

Upvotes: 1

Views: 206

Answers (1)

mechanical_meat
mechanical_meat

Reputation: 169354

Create another table with the >5000 tableids.

Then all that's left is an inner-join:

select t.* 
  from table_name t 
       inner join table_tableid tid
       on tid.tableid = t.tableid

Upvotes: 2

Related Questions