如何使用oracle创建带有小字符的表? [英] How I can create a table with oracle but with small characters?
问题描述
如何用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屋!