oracle的collation

本文探讨了如何在Microsoft SQL Server和Oracle数据库中进行不区分大小写和字符集的搜索,介绍了使用不同方法实现案例敏感搜索,并提供了查询当前数据库案例敏感设置的方法。
部署运行你感兴趣的模型镜像

一、

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

And that will find all "bobdillon" entries.

If I want to do the same in Oracle, I know I can do this:

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.

 

 

 

a:SELECT*

FROM MyTable
WHERE NLSSORT(MyField,'NLS_SORT = Latin_CI')= NLSSORT('BobDillon','NLS_SORT = Latin_CI')

二、

Where can I query the current case-sensitivity setting of an oracle database?

I've tried looking in v$databasenls_database_parameters, and looking through the system packages, but none of them seem to provide the information I need...

In 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(*) FROM    dual WHERE'a'='A'

  COUNT(*)
----------
1

SQL>ALTER SESSION SET NLS_COMP ='BINARY'

Session altered
SQL>SELECT  COUNT(*) FROM    dual  WHERE'a'='A'

  COUNT(*)
----------
0

From documentation:

NLS_COMP specifies the collation behavior of the database session.

Values:

  • BINARY

    Normally, comparisons in the WHERE clause and in PL/SQL blocks is binary unless you specify the NLSSORT function.

  • LINGUISTIC

    Comparisons for all SQL operations in the WHERE clause and in PL/SQL blocks should use the linguistic sort specified in the NLS_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 set NLS_COMP to LINGUISTIC

 http://stackoverflow.com/questions/1244804/where-can-i-query-an-oracle-databases-case-sensitivity

 

 

您可能感兴趣的与本文相关的镜像

GPT-SoVITS

GPT-SoVITS

AI应用

GPT-SoVITS 是一个开源的文本到语音(TTS)和语音转换模型,它结合了 GPT 的生成能力和 SoVITS 的语音转换技术。该项目以其强大的声音克隆能力而闻名,仅需少量语音样本(如5秒)即可实现高质量的即时语音合成,也可通过更长的音频(如1分钟)进行微调以获得更逼真的效果

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值