Oracle 中的重音和不区分大小写的 COLLATE 等价物
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/507504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Accent and case insensitive COLLATE equivalent in Oracle
提问by Jonathan
In Microsoft SQL Server, if I want to search case insensitively in a case-sensitive database, I can run the following SQL:
在 Microsoft SQL Server 中,如果我想在区分大小写的数据库中不区分大小写搜索,可以运行以下 SQL:
SELECT * FROM MyTable
WHERE MyField = 'BobDillon' COLLATE Latin1_General_CI_AI
And that will find all "bobdillon" entries.
这将找到所有“bobdilon”条目。
If I want to do the same in Oracle, I know I can do this:
如果我想在 Oracle 中做同样的事情,我知道我可以这样做:
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.
但我想知道是否有直接等同于 collate 关键字,以便我可以搜索我认为合适的区分大小写和区分重音。
回答by Quassnoi
SELECT *
FROM MyTable
WHERE NLSSORT(MyField, 'NLS_SORT = Latin_CI') = NLSSORT('BobDillon', 'NLS_SORT = Latin_CI')