| | |
problem with lengthy query
![]() |
•
•
Join Date: Sep 2004
Posts: 2
Reputation:
Solved Threads: 0
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:
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:
![]() |
Similar Threads
- Problem with Linq query (C#)
- Problem in inserting query in database (MySQL)
- Problem with MySQL Query (Database Design)
- Problem execute the Query (PHP)
- Problem regarding mysql query: it is displaying duplicate contents (MySQL)
- Query class problem (PHP)
- Problem with query. (MS SQL)
- query problem (MySQL)
Other Threads in the Java Forum
- Previous Thread: Printing in awt
- Next Thread: java price is right game help
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card class classes client code collision columns component constructor crashcourse database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javadoc javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle plazmic print problem program project radio recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree unlimited utility webservices windows





