Oracle数字类型number自增的实现代码

废话不多说了,直接给大家贴代码了,具体代码如下所示:

创建序列

create sequence seq_student
start with 6
increment by 1
maxvalue 500
nominvalue
nocycle
nocache;

创建触发器

create or replace trigger trigger_student
before insert on student
for each row
 declare
BEGIN
select seq_student.nextval into :new.id from dual;
END;

总结

相关推荐