How to ignore case and match string in Oracle SQL? For example, in the Oracle database if the string is stored as "Akujk Ctr12-i/E" and if the user enters the string as "akujk ctrl2-i/e" how to write the query in JDBC so that its still valid ignoring case?
Asked
Active
Viewed 1,465 times
-1
-
@a_horse_with_no_name - Oracle was mentioned in the question text. I have added a tag. – Gord Thompson May 05 '16 at 16:31
1 Answers
0
In Java take thus user input and make it upper case.
userString.toUpperCase()
In SQL, use upper function
upper(a_column) = ?
This will probably not allow the database to use an index, so you may need to add another index for the uppercase version of your column. This is only necessary if you are getting a performance hit because of this workaround.

Joseph K. Strauss
- 4,683
- 1
- 23
- 40
-
:Yeah I am able to change it to upper(a_column) in jdbc and check that the user value and the attribute value are same but when I am trying to insert the user inputted value into the database table its giving the following error ORA-02291: integrity constraint violated - parent key not found because the value stored in the database is combination of both lower and upper case I am not able to insert the value entered by the user – sephora May 05 '16 at 17:08
-
@sephora It looks like you have an existing row. In this case you should be updating - not inserting, but I am not sure what that has to do with question which looks like it is asking for a simple select. – Joseph K. Strauss May 05 '16 at 17:45