Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ignoring case in queries.........

 
Mallika Kumar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there a way I can make SQL queries case-insensitive in the select statement itself ? I'm passing user entered values to a prepared statement. My select statement looks like :
SELECT EMPNO,EMPNAME FROM EMPLOYEE WHERE EMPNAME LIKE ?
I'm using preparedStatement.setString(1,inputValue). Instead of modifing the inputValue with String class(ie,changing its case to format it to Mallika or Kumar,ie first letter capitalized and the rest in small case), can I specify in select statement itself to ignore the case of inputValue being passed ?
Any suggestions would be helpful.
Thanks.
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use the UPPER or LOWER functions to put everything in the same case.
The best thing to do is put it the way you need it in the database and use the upper/lower on the incoming data. If you use it on the database side I think the indexes will not be used.
ex: where name = upper(clientside_name)
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic