同意楼上,下面是测试全过程create sequence ssss increment by 1 start with 1 maxvalue 999999999;create table yyy ( aaa int ) alter table yyy add bbb char(12)create or replace trigger qqqqq before insert on yyy referencing old as old new as new for each row begin select ssss.nextval into :new.aaa from dual; end; insert into yyy(bbb) values('asdfasd')select * From yyy
CREATE SEQUENCE EXAM_NO_SEQ
START WITH 1484
MAXVALUE 9999999999
MINVALUE 1
CYCLE
CACHE 20
NOORDER;
//获取申请序号
SELECT exam_no_seq.nextval FROM dual
把这个序列号负值给表中的自动增长的字段就可以了.
(
aaa int
)
alter table yyy add bbb char(12)create or replace trigger qqqqq
before insert on yyy
referencing old as old new as new for each row
begin
select ssss.nextval into :new.aaa from dual;
end;
insert into yyy(bbb) values('asdfasd')select * From yyy