问题
ps=con.prepareStatement("select * from REGISTER inner join ORGAN on REGISTER.PATIENTID=ORGAN.PATIENTID where ORGAN.ORGAN LIKE ?");
ps.setString(1,"'%"+o.getOrgan()+"%'");
I executed the query in SQL Developer which works fine, but in DAO class it is not returning any result set.
回答1:
Use
ps.setString(1, "%" + o.getOrgan() + "%");
Note the absence of quotes.
来源:https://stackoverflow.com/questions/40192410/how-to-implement-like-operator-in-prepared-statement