-1

I've got a question. Why does my Oracle Express Edition requires double-quoted table names:

Not working select:

select * from table

Working select:

select * from "table" 

Thanks for answers and help with editing my post. I was confused how to name this case.

Endiss
  • 699
  • 2
  • 10
  • 23

2 Answers2

4

It requires double quote names only in case the name you are using is a keyword (and your example - table is in this situation) or if you want to include special characters or non-alphanumeric characters (e.g. "Multi word table name").

The names enclosed in " are case sensitive.

Cătălin Pitiș
  • 14,123
  • 2
  • 39
  • 62
0

Use doublequotes only: select * from "table";

it works without quotes only of name was created is in uppercase. By default all unquoted names are stored in uppercase.

For example:

CREATE TABLE "T1" (x number);

-- That works:
select * from "T1";

-- that works too:
select * from t1;

-- that works too:
select * from T1;

TABLE - is a keyword. So you can it use without quotes even if you used name in uppercase in create statement:

CREATE TABLE "TABLE" (x number);

select * from table;

ORA-00906: missing left parenthesis
Rusty
  • 1,988
  • 10
  • 12
  • I would recommend avoiding the use of keywords for databases, tables and column names and then the problem would not happen :) – Ren Apr 02 '13 at 09:55
  • Correct - good recommendation, but it does not contradict to the naming rules if use double quotes. – Rusty Dec 16 '13 at 12:26