I want to use sql "like" operator to get data set from the database. But sql like operator didn't work for me collection of words(word phrases). There for I have to add words into arraylist and word by word pass into sql like operator. That is huge time consuming. My query take lot of time because of my databse contains 1 million rows. Isn't it a proper way to put word phrases into like operator?
This is my code:
sb.append("SELECT Cor_Sentence FROM corpus Where ");
for(int k=0;k<wordList.size();k++){
sb.append( " Cor_Sentence like '%" + wordList.get(k) + "%' OR ");
}
sb.append(" 1=0");
Isn't there proper way to put whole content into between like operator :What is reason for below code type thing not work?
WholeContentHere="abcd bcde defg ffog gghk ";
sb.append("SELECT Cor_Sentence FROM corpus Where ");
sb.append( " Cor_Sentence like '%" WholeContentHere + "%'");
}