e.g。我有一张桌子:
create table test (testdata varchar2(255));
然后我需要一个自动增量字段:
alter table test add id numeric(10);
create sequence test_seq
start with 1
increment by 1
nomaxvalue;
create trigger test_trigger
before insert on test
for each row
begin
select test_seq.nextval into :new.id from dual;
end;
接下来我该怎么做才能用“id”中的序列号填充现有字段?
答案 0 :(得分:11)
update test
set id = test_seq.nextval