User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 391,583 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,677 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1694 | Replies: 0
Reply
Join Date: Sep 2004
Posts: 2
Reputation: ranyodh is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ranyodh ranyodh is offline Offline
Newbie Poster

Help problem with lengthy query

  #1  
Sep 3rd, 2004
hi to everyone....

I got a problem with queries.... before i tell my problem, please look at the is code -


// employeeCode is ArrayList containing employee codes.

String query = "SELECT Name, FatherName from Employee WHERE ";
for(int i=0; i<employeeCode.size(); i++) {
if(i == 0) {
query += " (EmployeeCode = "+Integer.parseInt((String)
employeeCode.get(i));
} else {
query += OR EmployeeCode = "+Integer.parseInt((String)
employeeCode.get(i));
}
}
query += ")";


Now, this code generate query somewhat like this -
"SELECT Name FatherName FROM Employee WHERE (EmployeeCode = 1 OR EmployeeCode = 2 OR EmployeeCode = 3 ......(and so on)"

My problem is that, employeeCode may have 1000's codes. and this query will become quite lengthy. Can Database engine handle such a long query. I know at some point, it give error message saying "Query is too complex".



I use jdbcodbc database engine.

can you suggest some ohter way.
:rolleyes:
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 10:57 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC