Wednesday, October 3, 2012

ORA-00972 or ORA-00903 while creating an object

I am reading 2 Day DBA for 11gR2 and came across below statement:

A schema object name must abide by certain rules. In addition to being unique within a schema, a schema object name cannot be longer than 30 bytes and must begin with a letter. If you attempt to create an object with a name that violates any of these rules, then the database raises an error.

I was curious to see what error codes would be that if the rules are violated. Below is the answer:


SQL> create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(srno number);
create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(srno number)
             *
ERROR at line 1:
ORA-00972: identifier is too long


SQL> create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(srno number);

Table created.

SQL> create table 1a(srno number);
create table 1a(srno number)
             *
ERROR at line 1:
ORA-00903: invalid table name


No comments:

Post a Comment