aspose file tools*
The moose likes JDBC 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
Bookmark "Ignoring case in queries........." Watch "Ignoring case in queries........." New topic
Author

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

Mallika Kumar
Ranch Hand

Joined: Feb 15, 2001
Posts: 61
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

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)
Dan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ignoring case in queries.........