本文介绍了口音和不区分大小写的COLLATE在Oracle中等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Microsoft SQL Server中,如果我想在区分大小写的数据库中不区分大小写地搜索,则可以运行以下SQL:
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
这将找到所有"bobdillon"条目.
And that will find all "bobdillon" entries.
如果我想在Oracle中做同样的事情,我知道我可以这样做:
If I want to do the same in Oracle, I know I can do this:
SELECT * FROM MyTable
WHERE UPPER(MyField) = 'BOBDILLON'
但是我想知道是否有与collate关键字直接等效的内容,因此我可以根据需要搜索区分大小写和重音符号.
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.
推荐答案
SELECT *
FROM MyTable
WHERE NLSSORT(MyField, 'NLS_SORT = Latin_CI') = NLSSORT('BobDillon', 'NLS_SORT = Latin_CI')
这篇关于口音和不区分大小写的COLLATE在Oracle中等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!