直入主题
--创建相同临时表
create table MET_ERR_ANAL_DET_TMP01 as select * from MET_ERR_ANAL_DET_TMP where 1=2
---复制相同表数据
insert into MET_ERR_ANAL_DET_TMP01 select * from MET_ERR_ANAL_DET_TMP
select t.detect_pf1_lmax_demo, t.detect_pf1_lmax,t.* from MET_ERR_ANAL_DET_TMP t
----修改字段类型
alter table MET_ERR_ANAL_DET_TMP modify (detect_pf1_lmax VARCHAR2(20));
---第一步 增加临时字段
alter table MET_ERR_ANAL_DET_TMP add detect_pf1_lmax_demo VARCHAR2(20);
;
--第二步 将值付给临时字段,目标字段赋值为null
update MET_ERR_ANAL_DET_TMP set detect_pf1_lmax_demo=detect_pf1_lmax, detect_pf1_lmax = null;
--第三步
alter table MET_ERR_ANAL_DET_TMP modify detect_pf1_lmax number;
--第四步
update MET_ERR_ANAL_DET_TMP set detect_pf1_lmax=detect_pf1_lmax_demo, detect_pf1_lmax_demo= null;
--删除字段
alter table MET_ERR_ANAL_DET_TMP drop column detect_pf1_lmax_demo;