SQL> conn xx
@xxtst as sysdba; --连接数据库
已连接。
SQL> create table melody.test (id int); --创建TABLE
表已创建。
SQL> alter table melody.test add id2 int; --增加列
表已更改。
SQL> alter table melody.test rename column id2 to id3; --重命名列
表已更改。
SQL> select * from melody.test;
未选定行
SQL> desc melody.test;
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
ID NUMBER(38)
ID3 NUMBER(38)
SQL> alter table melody.test drop id3;
alter table melody.test drop id3
*
第 1 行出现错误:
ORA-00905: 缺失关键字
SQL> alter table melody.test drop column id3;--删除列
表已更改。
SQL> desc melody.test;
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
ID NUMBER(38)
SQL> spool off;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22078283/viewspace-615795/
,如需转载,请注明出处,否则将追究法律责任。