I have found this answer useful: Accent and case insensitive COLLATE equivalent in Oracle, but my question is regarding LIKE searching with a version 9 Oracle db.
I
one method would be to modify your session parameters NLS_SORT
and NLS_COMP
:
SQL> SELECT Name FROM CollationTestTable WHERE NAME LIKE '%pe%';
NAME
--------------------------------------------------------------------------------
pepe
SQL> alter session set nls_sort=Latin_AI;
Session altered
SQL> alter session set nls_comp=linguistic;
Session altered
SQL> SELECT Name FROM CollationTestTable WHERE NAME LIKE '%pe%';
NAME
--------------------------------------------------------------------------------
pepe
pépé
PEPE
As shown in another SO, you cannot use the LIKE operator with NLSSORT
(this is because, NLSSORT returns a string of bytes that will be used for sorting, and LIKE only works with charater strings)
Update: While setting the NLS parameters would be my first choice, you could also use built-in functions to achieve the same result. A couple of examples:
SQL> SELECT Name
2 FROM CollationTestTable
3 WHERE upper(convert(NAME, 'US7ASCII'))
4 LIKE upper(convert('%pe%', 'US7ASCII'));
NAME
--------------------------------------------------------------------------------
pepe
pépé
PEPE
SQL> SELECT Name
2 FROM CollationTestTable
3 WHERE upper(translate(NAME, 'àâéèêìîòôùûÿ', 'aaeeeiioouuy'))
4 LIKE upper(translate('%pe%', 'àâéèêìîòôùûÿ', 'aaeeeiioouuy'));
NAME
-----------------------------------
pepe
pépé
PEPE