'Oracle - ORA-00903: invalid table name

I am unable to find the error with this statement:

 CREATE TABLE "FUEL_TRANSPORTATION_TYPES_RARF_ORIG"
  ( "ID" NUMBER(19,0) NOT NULL ENABLE, 
    "CODE" CHAR(2) NOT NULL ENABLE, 
    "DESCRIPTION" VARCHAR2(32), 
    "CREATED" DATE DEFAULT CURRENT_DATE NOT NULL ENABLE, 
    "UPDATED" DATE DEFAULT CURRENT_DATE NOT NULL ENABLE, 
     CONSTRAINT "PK_FUEL_TRANSPORTATION_TYPES" PRIMARY KEY ("ID")
                    USING INDEX (create unique index "UX_FUEL_TRANSPORTATION_TYPES" on "FUEL_TRANSPORTATION_TYPES" ("ID")));

It's failing with error ORA-00903: invalid table name.

Where is the syntax error?



Solution 1:[1]

You seem to be using modified DDL from an existing table. You've changed the table name, from FUEL_TRANSPORTATION_TYPES to FUEL_TRANSPORTATION_TYPES_RARF_ORIG; but you didn't change the reference to it in the index:

(create unique index "UX_FUEL_TRANSPORTATION_TYPES" on "FUEL_TRANSPORTATION_TYPES" ("ID"))

should be

(create unique index "UX_FUEL_TRANSPORTATION_TYPES" on "FUEL_TRANSPORTATION_TYPES_RARF_ORIG" ("ID"))

db<>fiddle

Solution 2:[2]

I resolved it..

I had a different table name in the using index (create unique index "UX_FUEL_TRANSPORTATION_TYPES" on "FUEL_TRANSPORTATION_TYPES" ("ID"));

IT should be (create unique index "UX_FUEL_TRANSPORTATION_TYPES" on "FUEL_TRANSPORTATION_TYPES_RARF_ORIG" ("ID"));

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alex Poole
Solution 2 P.Sav