Attempted to run the query from extracting data from a specific website, but picking up ORA-00907: missing right parenthesis instead.
public static void build(){
Connection con = null;
ResultSet rs = null;
Statement stms = null;
String buildXML ="";
String list = lists.stream().collect(Collectors.joining("','"));
try {
<<<database>>>
<<<connection>>>
rs = stmt.executeQuery("select name, type, dob, age, height, weight from peopleH where name in ('" + list + "') and age !=0 and dob !=0"); <-- *error here?!?*
while(rs.next()){
for(int i=0; lists.size() > i; i++){
if(<<does not contain the name>>){
<<<do this>>>
}
else {
<<<do that>>>
}
}
}
}
catch(){
} finally{
}
}
What's meant to happen is that when data is filter and extracted via selenium (which is stored in an arrayList). The query above will query the arraylist and compare with the database against what is display on the selenium browser.
however the query above is pitching out missing right parenthesis... I can't seem to find the issue here as last checked there is no addition , or invalid logic (in (***) and 'and' statement).
the data being filtered from selenium is printing out as expected e.g john, sam, smith, mary, lili, happy
if placed in query it will be something like this
rs = stmt.executeQuery("select name, type, dob, age, height, weight from peopleH where name in ('john','sam','smith','mary','lili','happy') and age !=0 and dob !=0");
to something like this
rs = stmt.executeQuery("select name, type, dob, age, height, weight from peopleH where name in ('" + list + "') and age !=0 and dob !=0");