哪里可以查询oracle数据库当前的区分大小写设置?
我尝试查看v$database
、nls_database_parameters
,并查看系统包,但它们似乎都没有提供我需要的信息......
最佳答案
在Oracle 10gR2
中:
SELECT *
FROM NLS_SESSION_PARAMETERS
WHERE parameter IN ('NLS_COMP', 'NLS_SORT')
SQL> ALTER SESSION SET NLS_COMP = 'LINGUISTIC'
2 /
Session altered
SQL> SELECT COUNT(*)
2 FROM dual
3 WHERE 'a' = 'A'
4 /
COUNT(*)
----------
1
SQL> ALTER SESSION SET NLS_COMP = 'BINARY'
2 /
Session altered
SQL> SELECT COUNT(*)
2 FROM dual
3 WHERE 'a' = 'A'
4 /
COUNT(*)
----------
0
来自documentation :
NLS_COMP
specifies the collation behavior of the database session.Values:
BINARY
Normally, comparisons in the
WHERE
clause and inPL/SQL
blocks is binary unless you specify theNLSSORT
function.
LINGUISTIC
Comparisons for all
SQL
operations in theWHERE
clause and inPL/SQL
blocks should use the linguistic sort specified in theNLS_SORT
parameter. To improve the performance, you can also define a linguistic index on the column for which you want linguistic comparisons.
ANSI
A setting of
ANSI
is for backwards compatibility; in general, you should setNLS_COMP
toLINGUISTIC
关于oracle - 在哪里可以查询oracle数据库的大小写敏感度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1244804/