As I had written in title, I have SQL query, run on Oracle DB, lets say:
SELECT * FROM TABLE WHERE TABLE.NAME Like \'IgNoReCaSe\'
If I woul
Select * from table where upper(table.name) like upper('IgNoreCaSe');
Alternatively, substitute lower for upper.
You can convert both values to upper or lowercase using the upper
or lower
functions:
Select * from table where upper(table.name) like upper('IgNoreCaSe')
or
Select * from table where lower(table.name) like lower('IgNoreCaSe');
You can use either lower or upper function on both sides of the where condition
You can use ALTER SESSION statements to set comparison to case-insensitive. See this FAQ.
alter session set NLS_COMP=ANSI;
alter session set NLS_SORT=BINARY_CI;
For all those visiting 8 years after this original answer has been accepted (for 10gR2):
After 10gR2, the NLS_COMP
setting must be `LINGUISTIC':
ALTER SESSION SET NLS_COMP=LINGUISTIC;
You can use the upper() function in your query, and to increase performance you can use a function-base index
CREATE INDEX upper_index_name ON table(upper(name))
You could also use Regular Expressions:
SELECT * FROM TABLE WHERE REGEXP_LIKE (TABLE.NAME,'IgNoReCaSe','i');