如何让Oracle不区分大小写
Oracle 10g 中是否有设置将数据视为不区分大小写?我在此处看到了一个解决方案。然而,这是在会话中完成的。我正在寻找的是模式或表上的设置,以将其数据视为不区分大小写。如果是在会话上,那么我将不得不对所有存储过程进行更改。
Is there be a setting in Oracle 10g to consider data as case insensitive? I saw a solution here. However, that is done on a session. What I am looking for is a setting either on a schema or on a table to consider its data as case insensitive. If it is on a session then I will have to make the change on all the stored procedures.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有选项可以使架构或表“不区分大小写”。
您可以使用 NLS_ 参数在会话上执行此操作,或者在影响整个实例的数据库初始化文件中执行相同操作。
但是这些搜索仅不区分大小写用于严格相等搜索。
如果您需要使用 LIKE,则需要考虑使用 REGEXP_LIKE。
对于 REGEXP_LIKE,您不需要 NLS_SORT 设置,因为 REGEXP_LIKE 有一个选项可以让它考虑不区分大小写的事物。
There is no option to make a schema or table 'case insensitive'.
You can do that on the session using the NLS_ parameters or do the same in the db init file where the whole instance is affected.
However those searches are only case-insensitive for strict equality searches.
If you need to use LIKE you then need to consider using REGEXP_LIKE.
In the case of REGEXP_LIKE you don't need an NLS_SORT setting because there is an option for REGEXP_LIKE to have it consider things case insensitive.
区分大小写是计算的基础,原因很简单,“yun”的 ASCII 值!=“YUN”的 ASCII 值。所以,当你说...
...您的意思是仅用于搜索还是存储?
在每次搜索中强制执行大小写的问题是:
如果在模式或表级别强制执行不区分大小写的搜索,我们如何区分“sam-I-am”和“SAM-I-AM”?
尽管是在单个列级别,但在某种程度上可以强制数据存储不区分大小写:
Case sensitivity is fundamental to computing, for the simple reason that the ASCII value of 'yun' != the ASCII value of 'YUN'. So, when you say ...
... do you mean just for the purposes of search or for storage as well?
The problem with enforcing case on every search is this:
If case insensitive searches are enforced at the schema or table level how can we ever distinguish 'sam-I-am' from 'SAM-I-AM'?
It is - sort of - possible to enforce case-insensitivity for data storage, albeit at the individual column level: