用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.