oracle是区分大小写的原因? [英] Reason why oracle is case sensitive?

查看:111
本文介绍了oracle是区分大小写的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有原因为什么Oracle是区分大小写的,而其他人像SQL Server,MySQL不是默认的?

我知道有些方法可以启用/禁用区分大小写,但是oracle与其他数据库不同,似乎很奇怪。

I know that there are ways to enable/disable case sensitivity, but it just seems weird that oracle differs from other databases.

我也想了解区分大小写的原因。我可以看到表和TaBlE可以被认为是等同的,而不是等同的,但是有一个例子,案例敏感性实际上会有所不同吗?

I'm also trying to understand reasons for case sensitivity. I can see where "Table" and "TaBlE" can be considered equivalent and not equivalent, but is there an example where case sensitivity would actually make a difference?

对于数据库来说,这个数据库有点新鲜,目前正在上课。

I'm somewhat new to databases and am currently taking a class.

推荐答案

默认情况下,Oracle标识符(表名,列名等) 。)是case- 不敏感。您可以通过在其周围使用引号来区分大小写(例如: SELECT * FROMMy_TableWHEREmy_field= 1 )。 SQL关键字( SELECT WHERE JOIN 等)总是不区分大小写。

By default, Oracle identifiers (table names, column names, etc.) are case-insensitive. You can make them case-sensitive by using quotes around them (eg: SELECT * FROM "My_Table" WHERE "my_field" = 1). SQL keywords (SELECT, WHERE, JOIN, etc.) are always case-insensitive.

另一方面,字符串比较是case- 敏感(例如: WHERE默认情况下,field ='STRING'将只匹配'STRING'的列。您可以通过将 NLS_COMP NLS_SORT 设置为适当的值(例如: LINGUISTIC BINARY_CI )。

On the other hand, string comparisons are case-sensitive (eg: WHERE field='STRING' will only match columns where it's 'STRING') by default. You can make them case-insensitive by setting NLS_COMP and NLS_SORT to the appropriate values (eg: LINGUISTIC and BINARY_CI, respectively).


注意:当查询数据字典视图(例如: dba_tables )时,名称将大写,如果您创建它们没有引号,并且字符串比较规则如第二个

Note: When inquiring data dictionary views (eg: dba_tables) the names will be in upper-case if you created them without quotes, and the string comparison rules as explained in the second paragraph will apply here.

某些数据库(Oracle,IBM DB2,PostgreSQL等)将默认执行区分大小写的字符串比较,其他不区分大小写(SQL Server,MySQL,SQLite)。这不是任何手段的标准,所以只需要知道你的数据库设置。

Some databases (Oracle, IBM DB2, PostgreSQL, etc.) will perform case-sensitive string comparisons by default, others case-insensitive (SQL Server, MySQL, SQLite). This isn't standard by any means, so just be aware of what your db settings are.

这篇关于oracle是区分大小写的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆