Oracle: Rename column gives "ORA-00903: invalid table name" error even when no constraint or index is there

3k Views Asked by At
RENAME COLUMN table-Name.simple-Column-Name TO simple-Column-Name

When i try to rename column i am getting following error message on all columns:

RENAME COLUMN EMP_NEW.EMPLOYEE_ID TO EMPLOYEEID
Error report -
ORA-00903: invalid table name
00903. 00000 -  "invalid table name"
*Cause:    
*Action:

Following is version

Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
PL/SQL Release 12.1.0.1.0 - Production
"CORE   12.1.0.1.0  Production"
TNS for IBM/AIX RISC System/6000: Version 12.1.0.1.0 - Production
NLSRTL Version 12.1.0.1.0 - Production

Any suggestion how to resolve this issue? (Note i have created structure from some existing table and not copied anything i.e no index, no constraint nothing, so it is simple create)

2

There are 2 best solutions below

0
Gro On

Correct Syntax is

ALTER TABLE table_name RENAME COLUMN old_name TO new_name;

Use following. but ensure EMP_NEW table is present in the schema you have used to logon

ALTER TABLE EMP_NEW RENAME COLUMN EMPLOYEE_ID TO EMPLOYEEID;
5
Ori Marko On

EDIT

Don't use this syntax, this is derby syntax, use @Gro answer (alter table)

Make sure table not in different scheme than user, or use scheme name.

Also make sure there aren't any open cursors that reference the column

Restriction: The RENAME COLUMN statement is not allowed if there are any open cursors that reference the column that is being altered.