用pl/sql工具rename一个表名时报ora-14155和ora-14047错误,过程如下:

1.创建测试表

17:14:43 SQL> create table test_id (id int,addr  varchar2(50));

Table created.

2.rename表名,报错 ORA-14155: missing PARTITION or SUBPARTITION keyword,原因分析:语法错误,正确语法应是rename to

17:17:47 SQL> alter table hr.test_id rename hr.test_addr;
alter table test_id rename test_addr
                           *
ERROR at line 1:
ORA-14155: missing PARTITION or SUBPARTITION keyword

3.rename to表名,报错,ORA-14047: ALTER TABLE|INDEX RENAME may not be combined with other operations,原因分析:当你执行alter table hr.test_id 的时候,你已经告诉oracle你要修改哪个用户下的哪个表了,所以在rename to 的时候就不需要在指定用户名称了.如果在写用户名的话,oracle也许会认为你是要把hr下的test_id 表改名存储到其他用户下面去,oracle不允许这么做!

17:18:17 SQL> alter table hr.test_id rename to hr.test_addr;
alter table hr.test_id rename to hr.test_addr
                                   *
ERROR at line 1:
ORA-14047: ALTER TABLE|INDEX RENAME may not be combined with other operations

4.rename表名成功

17:19:05 SQL> alter table hr.test_id rename to test_addr;

Table altered.

 

posted on 2019-06-25 17:31  Tomatoes  阅读(1719)  评论(0编辑  收藏  举报