没有 两种方法 方法一: 用触发器建一个序列 create sequence a_seq increment by 1 start with 100; 建一个触发器, 自动+1 create or replace trigger t_a before insert on a for each row begin select s_a.nextval into :new.b from dual; end;方法二: 建一个序列 create sequence a_seq increment by 1 start with 100; 在语句中+1 insert into tbl(id,....) values (a_seq.nextval,....)
create sequence seq_name increment by 1 start with 1 maxvalue 99999999 nocycle cache 10insert into table(id,...) values(seq_name.nextval,....)
或者取max(编号)再+1
两种方法
方法一:
用触发器建一个序列
create sequence a_seq increment by 1 start with 100;
建一个触发器, 自动+1
create or replace trigger t_a
before insert on a
for each row
begin
select s_a.nextval into :new.b from dual;
end;方法二:
建一个序列
create sequence a_seq increment by 1 start with 100;
在语句中+1
insert into tbl(id,....)
values (a_seq.nextval,....)
increment by 1
start with 1
maxvalue 99999999
nocycle
cache 10insert into table(id,...) values(seq_name.nextval,....)