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

2

12

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.

Pentad answered 12/11, 2012 at 10:35 Comment(6)
what do you want to do? give us more information pleaseDuplet
Record is getting converted to upper case or table columns are getting converted into lower upper case?Stuffy
when i execute this query "create table t ( a number, b varchar2(10) )"Pentad
the name of the table and columns became capital characters not small charactersPentad
and I use Oracle SQL Developer Data ModelerPentad
@Pentad I doubt you can change that, Oracle creates tables, columns in upper case.Stuffy
W
28

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.

Waitabit answered 12/11, 2012 at 11:8 Comment(2)
agreed with a horse with no name' I've seen and had to debug production code that used this, as the guys who wrote the app were Java developers that for some reason LOVE using camel case table and column names, as that's the way they type identifiers in Java. it's an absolute nightmare to maintain this in oracle. you almost feel like throwing the keyboard through the monitor when you see hundreds of views that all contain mixed case columns + view names and you get asked to tune some sql against them.Mccurdy
Agreed, great explanation - short and sweet and directly to the point!Slipstream
B
0

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.

Beeswax answered 12/11, 2012 at 11:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.