wild card on mysql prepared statement
843859Dec 6 2005 — edited Dec 7 2005hi i want to use wild card % sign to MySQL prepared statement. example
pstmt=con.prepareStatement("select SALARY from SALARIES where NAME like ?");
pstmt.setString(1,name);
ResultSet rs=pstmt.executeQuery();
what if the value of name variable is ch and i want to search all names that with the characters "ch" regardles of what comes before and after. for not prepared statement.
stmt.executeQuery("select salary from salaries where name=%ch%");
thanks in advance for your help.