Oracle數字類型number自增的實現代碼

創建序列

?

1

2

3

4

5

6

7

create sequence seq_student

start with 6

increment by 1

maxvalue 500

nominvalue

nocycle

nocache;

創建觸發器

?

1

2

3

4

5

6

7

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;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章