Got this sql (selection between ranks):
//Variables come from outside or other classes etc...
"SELECT * from users where dept_name= ? AND birth_date >=? AND birth_date <=? AND money >=? AND money <=?;
//Long preparedStatement code...
Using the next code to pass dept_name to the sql:
System.out.println("Insert department name: ");
Scanner alpha = new Scanner(System.in);
String dept_name= alpha.nextLine();
What happens if I don't insert anything on the scanner and I simply press enter? Like if I want to skip the search by dept_name and I only want to search between birth_date and money ranks?
How can I handle:
pstmt.setString(1, users.getDeptname()); //prepared statement
If it previously received a "enter" as character on the dept_id ?
How can Oracle ignore dept_name =? if no valor is passed in the "?" with prepared statement and use the next fields in the SQL to continue the query?