alter table 的功能是修改表格。包括重名命,加减字段,修改字段类型和大小,处理 约束等等。本例子之处理表名和字段,代码如下:
create
table
liu(a
varchar2
(
20
),b
number
(
2
))
alter table liurename to jin
renamejin to cai
alter table cai add c varchar2 ( 30 )
alter table cai add (d varchar2 ( 30 ),e number ( 4 ))
alter table cairename column e to f
alter table caimodifyd varchar ( 40 )
alter table caimodifyf varchar ( 40 )
alter table cai drop column f
alter table liurename to jin
renamejin to cai
alter table cai add c varchar2 ( 30 )
alter table cai add (d varchar2 ( 30 ),e number ( 4 ))
alter table cairename column e to f
alter table caimodifyd varchar ( 40 )
alter table caimodifyf varchar ( 40 )
alter table cai drop column f