1.创建sequence就可以
create sequence seq_name
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 20;
可以直接在插入时调用seq_name.nextval;
如insert into table_name(proid) values(seq_name.nextval);
2.也可以创建触发器(先要创建sequence):
create or replace trigger trg_name
before insert on table_name
for each row
begin
select seq_name.nextval into :new.column_name from dual;
end;
create sequence seq_name
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 20;
可以直接在插入时调用seq_name.nextval;
如insert into table_name(proid) values(seq_name.nextval);
2.也可以创建触发器(先要创建sequence):
create or replace trigger trg_name
before insert on table_name
for each row
begin
select seq_name.nextval into :new.column_name from dual;
end;