How to pass more than 1000 entries in 'IN' clause, Oracle 11g
690485Jul 13 2010 — edited Oct 29 2010Hi All,
I know this is a very common question in Oracle discussion forum. But, Im in different zone.
I use C#, .NET and Oracle 11g. I have a situation where I will create a query statement using 'IN' clause in C# code based on my requirement and execute that statement from code itself with oracle connection object. I do not have any procedures. I must phrase my query statement and pass it on to OracleConnection object to execute it.
My code looks like this....
List<decimal> x_Ids = new List<decimal>();
{
I will load my IDs into x_Ids here;
}
string whereInClause = ........I will prepare a 'IN' clause (All IDs separated by ',')
My query would looks like this....
string query = select * from MYTABLE where X_ID in [ whereInClause with more than 1000 entries]
oraConn.ExecuteQuery(query);
I have a workaround with OR operator with 'IN' clause like below.
X_ID in [ Ids till 1000 entries] OR X_ID in [Next 1000 entries] OR X_ID in [Next 1000 entries] ....so on.....
It is working, but, I heard that this may slowdown the performance of the application. Is this really a performance hit to my application?
Can you please suggest any other workaround to overcome this situation?