简体   繁体   中英

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

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 ie no index, no constraint nothing, so it is simple create)

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;

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM