How to write dynamic sql query in a data source

User150433
Tera Guru

I have a scenario where I need to query a database and get the details of users specified in the where condition.The condition looks like this:
select * from myTable where employeeId IN(501763663,501732323,500117338,....100 such entries,501689434)
Now the problem that I am facing is the mid server is taking too long to respond and finally I get an error saying 'Did not get any response from the mid server after waiting for 310 seconds'. This may be due to in efficiency of IN query.
If I run the same query in the PL SQL,I get the response in 10-15 seconds.
So I thought of running the data source multiple times for each employee id by making the sql query dynamic.The query will look like this.
select * from myTable where employeeId = 501763663;
Immediately after running this data source I will update the data source sql statement and run the data source again.
select * from myTable where employeeId = 501732323;

This approach does not seem to work properly.

Can anyone please provide some help on this?

5 REPLIES 5