File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Ignoring case in queries......... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Ignoring case in queries........." Watch "Ignoring case in queries........." New topic

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

Mallika Kumar
Ranch Hand

Joined: Feb 15, 2001
Posts: 61
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 :
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.
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
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)
I agree. Here's the link:
subject: Ignoring case in queries.........
It's not a secret anymore!