简体   繁体   English

Oracle:即使没有约束或索引,“重命名”列也会给出“ ORA-00903:无效的表名”错误

[英]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 但请确保您用于登录的架构中存在EMP_NEW表

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 ) 不要使用此语法,这是derby语法,请使用@Gro答案( 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. 限制:如果有任何打开的游标引用正在更改的列,则不允许RENAME COLUMN语句。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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