0

I have been getting the error during a table creation. I know it means that the table name needs to change, but I don't see any object with the same name. A copy of the .lst is below.

Thanks

SQL> CREATE TABLE CUSTOMERtable
  2   (
  3          CUSTOMERID      INT NOT NULL,
  4          CUSTNAME        VARCHAR2 (50) NOT NULL,
  5          ADDRESS         VARCHAR2 (100) NOT NULL,
  6          PHONENUMBER     VARCHAR2 (10)   NOT NULL,
  7          CONSTRAINT IDS_CUST_PK PRIMARY KEY (CUSTOMERID)
  8   );
CREATE TABLE CUSTOMERtable
             *
ERROR at line 1:
ORA-00955: name is already used by an existing object 


SQL>
SQL> 
SQL> CREATE TABLE RENTALStable
  2  (
  3          RENTALID        INT         NOT NULL,
  4          OUTDATE         DATE    NOT NULL,
  5          INDATE      DATE    NOT NULL,
  6          LATEFEE         INT,
  7          DAMAGEFEE       INT,
  8          REWINDFEE       INT,
  9          ID_CUSTOMER INT,
 10          CONSTRAINT RentalsTable_IDS_PK PRIMARY KEY (RENTALID),
 11          FOREIGN KEY (ID_CUSTOMER) REFERENCES CUSTOMERtable(CUSTOMERID)
 12  );

 Table created.
OttoMeter
  • 3
  • 2
  • 4
    `desc CUSTOMERtable` or `select * from all_objects where object_name = 'CUSTOMERTABLE'` to see the object that already exists with that name. Possibly you just want to drop the existing object. As an aside, I can't imagine why you would put `table` in the name of each of your tables. That seems very unliklely to be useful. – Justin Cave Apr 27 '16 at 14:30

1 Answers1

1

This should find the object that's creating the problem:

select *
  from user_objects
  where object_name = 'CUSTOMERTABLE'

Notice that your statement, even if you write CUSTOMERtable ( upper and lower case), will try to create a table named CUSTOMERTABLE (upper case). If you want to keep two objects with the same names but different case (and it seems not a good idea to me) you should use double quotes:

CREATE TABLE "CUSTOMERtable" ( ...
Aleksej
  • 22,443
  • 5
  • 33
  • 38