The moose likes JDBC and the fly likes case sensitive search in Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "case sensitive search in Oracle" Watch "case sensitive search in Oracle" New topic

case sensitive search in Oracle

shikhar singh
Ranch Hand

Joined: Oct 02, 2000
Posts: 31
As we all know search in Oracle are case sensitive.
But how will somebody extract something like "java" when the actual value stored in db is "JaVa".
Is there any way to achieve this.
Any help would be appreciated..
Wagner Danda

Joined: Jul 10, 2001
Posts: 26
you could use UPPER on your joins, like this:

and for a more performatic query, create an index with de UPPER function.
Wagner Danda

Wagner Danda<br />Sun Certified Programmer for Java 2 Platform
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Hi sikhar
C u have to do one thing..
if it helps u ...
what ever values u r storing in database just make one trend ...inserta ll values in one case ..choose ..upper case or lower case ...
and when u search for ...any word change the type of string in same case which u choosed for at the time of inserting .....
this works fine ..Iam running it for a nice search may user fill upper or lower it works fine...

Want to do something great will do one day
shikhar singh

Joined: Jan 25, 2001
Posts: 11
Hi Sandeep,
Your approach will work. But this can't be applied everywhere. For example in my case (email management system) where following customer info is to be stored:
Customer name.
Customer will not agree to change the name for example from 'Sandeep Balyan' to sandeep balyan'.
Anyway thanks for all your inputs and keep updated if something new comes up
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Hi friend IAm not telling u to say u r user to change write according to u ..
C do one thing
U must be taking u r values from a form ..
and taking in jsp using.or any thing u must be doing .by
String A=request.getParameter ...Method...
after taking a value in variable..just use
String B=A.toUpperCase();
and than save to database it will be always in same case may u r user enter in any case..
I think so this wiil help u ..
shikhar singh

Joined: Jan 25, 2001
Posts: 11
Hi sandeep,
Agreed with your point. But my question is:
Definitely you can store the data as you want (in uppercase or lowercase). But what about retriveing and displaying the data.
User has entered 'JaVa'. Server componeny has changed and persisted it as 'JAVA'.
But how will you retrieve it back and display it as 'JaVa'.
wood burning stoves
subject: case sensitive search in Oracle
Similar Threads
IllegalStateException:No data type for node: org.hibernate.hql.ast.tree.IdentNode IdentNode:'Id'
Code review required for converting dateformat
'class' or 'interface' expected
Java Compile Errors
Java case sensitive