I have a java method like below:
public String qE (String query, String selector) throws QSLException, IOException{
String sqlQuery = properties.getPRoperty(query);
PreparedStatement ps = conn.preparedStatement(sqlQuery);
ps.setFetchSize(100);
ps.setString(1,selector);
ps.setString(2,selector);
ResultSet rs = ps.executeQuery();
String rs = "";
while(rs.next()){
queryValue = rs.getString(1);
}
return queryValue;
}
When I run it with qe parameters (employees, second_name), then this request should be executed:
SELECT count(second_name)
FROM employees
WHERE second_name is not null
The problem is that not the employees have a middle name, and I should get 0, and the whole method should return 0, but I always get a great number greater than zero.
Can someone tell me why this doesn't return 0, but always a great number, like 2399 for example?
source
share