3

This is related to making oracle sorting case-insensitive. Most of the solutions I have seen mentions setting below session params :

ALTER SESSION SET NLS_COMP = LINGUISTIC;
ALTER SESSION SET NLS_SORT = BINARY_CI;

By default NLS_COMP is BINARY.

I found that if I just set NLS_SORT to BINARY_CI without setting the NLS_COMP to LINGUISTIC, it still works, i.e oracle sort becomes case-insensitive. Is there any advantage to setting NLS_COMP param ?

4

1 回答 1

4

NLS_COMP并且NLS_SORT效果略有不同。NLS_COMP顾名思义,就是为了比较。NLS_SORT顾名思义,就是用于排序。设置NLS_COMPLINGUISTIC使比较遵循排序规则,使比较使用该NLS_SORT设置。当您尝试时,您可以看到不同之处:

SELECT 1 FROM DUAL WHERE 'A' = 'a';

NLS_COMP = BINARY,比较结果为假。使用NLS_COMP = LINGUISTICNLS_SORT = BINARY_CI,比较结果为真。

是否应该设置取决于您希望从查询中获得什么结果。

于 2014-12-23T00:14:45.800 回答