1.将原有主键字段id改名为tmp_id并取消主键
2.保存
3.重新添加字段id并设置为主键,保存报错(报错可忽略,此时进行4-8步)
4.添加sequence create sequence seq_Z_PHYTASK_RESUME
increment by 1
start with 1
nomaxvalue
nominvalue
nocache;
5.填充主键为自增序列
update Z_PHYTASK_RESUME set id = seq_Z_PHYTASK_RESUME.nextval;
6.确认是否重新设置主键
7.创建触发器
create or replace trigger seq_Z_PHYTASK_RESUME
before insert on Z_PHYTASK_RESUME for each row
begin
select seq_Z_PHYTASK_RESUME.nextval into :new.id from dual;
end;
8.删除tmp_id字段