如何使用oracle创建带有小字符的表? [英] How I can create a table with oracle but with small characters?

查看:97
本文介绍了如何使用oracle创建带有小字符的表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用oracle创建带有小字符的表,当我创建带有小字符的表时,它将自动转换为大写字符.

How I can create a table with oracle but with small characters, when I create a table with small characters it converts auto to capital characters.

推荐答案

ANSI SQL标准要求将表名折叠(不带引号)为大写.

Folding (non-quoted) table names to upper case is required by the ANSI SQL standard.

可以使用带引号的标识符(再次遵循SQL标准)创建具有小写名称的表(和列):

You can create tables (and columns) with lowercase names using a quoted identifier (again this follows the SQL standard):

CREATE TABLE "foo" 
(
   "id"          integer,
   "SomeColumn"  varchar(100)
);

不过,我强烈建议您 这样做.

I would however strongly advise you, to not do that.

一旦以这种方式创建了表,就必须始终使用双引号 ,因为任何未加引号的名称都将(遵循SQL标识符规则)再次被使用折叠成大写形式,因此与存储在系统目录中的名称不匹配.

Once you have your tables created that way, you have to always use double quotes because any non-quoted name will (following the rules for SQL identifiers) again be folded to upper-case and thus won't match the name as it is stored in the system catalogs.

因此,以下语句将不起作用:

SELECT id, somecolumn FROM foo;

您必须使用带引号的标识符:

You have to use a quoted identifier:

SELECT "id", "SomeColumn" FROM "foo";

有关(带引号的)标识符的更多详细信息,请阅读

For more details on (quoted) identifiers, please read the chapter Database Object Naming Rules in the manual.

这篇关于如何使用oracle创建带有小字符的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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