Monday, June 27, 2005
Using Bad Names in Oracle
In Oracle, you can't start a table, procedure or variable name with a number.
SQL> CREATE TABLE 123Table (aval NUMBER);
CREATE TABLE 123Table (aval NUMBER)
*
ERROR at line 1:
ORA-00903: invalid table name
You can get around this simply using quotes.
SQL> CREATE TABLE "123Table" (aval NUMBER);
Table created.
This will take the name very literally. So literally, in fact, that you can no longer rely on Oracle's typical case-insensitivity.
SQL> drop table "123TABLE";
drop table "123TABLE"
*
ERROR at line 1:
ORA-00942: table or view does not exist
You can also use quotes to use reserved words.
SQL> CREATE TABLE "TABLE" ("NUMBER" NUMBER);
Table created.
SQL> CREATE TABLE 123Table (aval NUMBER);
CREATE TABLE 123Table (aval NUMBER)
*
ERROR at line 1:
ORA-00903: invalid table name
You can get around this simply using quotes.
SQL> CREATE TABLE "123Table" (aval NUMBER);
Table created.
This will take the name very literally. So literally, in fact, that you can no longer rely on Oracle's typical case-insensitivity.
SQL> drop table "123TABLE";
drop table "123TABLE"
*
ERROR at line 1:
ORA-00942: table or view does not exist
You can also use quotes to use reserved words.
SQL> CREATE TABLE "TABLE" ("NUMBER" NUMBER);
Table created.
Comments:
<< Home
I like this post so I have translated it into Spanish here.
Me gusta este ejemplo y por eso he puesto una traducción española aquí.
Me gusta este ejemplo y por eso he puesto una traducción española aquí.
(Please delete my earlier comment)
I like this post so I have translated it into Spanish here.
Me gusta este ejemplo y por eso he puesto una traducción española aquí.
I like this post so I have translated it into Spanish here.
Me gusta este ejemplo y por eso he puesto una traducción española aquí.
(Please delete my earlier comments)
I like this post so I have translated it into Spanish here.
Me gusta este ejemplo y por eso he puesto una traducción española aquí.
Post a Comment
I like this post so I have translated it into Spanish here.
Me gusta este ejemplo y por eso he puesto una traducción española aquí.
<< Home