17,137
社区成员




alter table A rename column ORDER_NO to HEAD_ROW_ID;
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.2.0
Connected as test@MSGDE
SQL>
SQL> -- 你是哪个版本的库
SQL> create table test(id int, ORDER_NO int as (id * 100), v1 int as (id * 2) );
Table created
SQL> insert into test(id) values(100);
1 row inserted
SQL> select * from test ;
ID ORDER_NO V1
--------------------------------------- ---------- ----------
100 10000 200
SQL> -- 1、重命名列
SQL> alter table test rename column ORDER_NO to HEAD_ROW_ID;
Table altered
SQL> -- 2、删除再添加
SQL> alter table test drop column v1 ;
Table altered
SQL> alter table test add v2 int as (id * 10);
Table altered
SQL> select * from test ;
ID HEAD_ROW_ID V2
--------------------------------------- ----------- ----------
100 10000 1000
SQL> drop table test purge ;
Table dropped
SQL>