How I can create a table with oracle but with small characters?

二次信任 提交于 2019-12-04 03:11:57

问题


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.


回答1:


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

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.

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.

Therefor the following statement will not work:

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.




回答2:


Enclose table name in quotation marks ("). Also create your table like this

create table "t" ( a number, b varchar2(10) );

Now your table name is t in lowercase. You have to use quotation marks always, when you access your table. For example

select * from "t";

You can use same construct for other objects (columns, indexes, ...).

Anyway, SQL is case insensitive, you need a good reason to use case dependent object names.



来源:https://stackoverflow.com/questions/13342165/how-i-can-create-a-table-with-oracle-but-with-small-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!