tags:

views:

1688

answers:

1

In Microsoft SQL Server, if I want to search case insensitively in a case-sensitive database, I can run the following SQL:

SELECT * FROM MyTable
WHERE MyField = 'BobDillon' COLLATE Latin1_General_CI_AI

And that will find all "bobdillon" entries.

If I want to do the same in Oracle, I know I can do this:

SELECT * FROM MyTable
WHERE UPPER(MyField) = 'BOBDILLON'

But I want to know if there is a direct equivalent to the collate keyword, so I can search for case sensitivity and accent sensitivity as I see fit.

+3  A: 
SELECT *
FROM MyTable
WHERE NLSSORT(MyField, 'NLS_SORT = Latin_CI') = NLSSORT('BobDillon', 'NLS_SORT = Latin_CI')
Quassnoi