ORACLE数据库id自增

时间:2021-08-23 03:04:53

1.先创建好一张表

2.创建好序列

create sequence seq_t_dept
minvalue 60
maxvalue 99999999
start with 60
increment by 1
cache 50

 

3.再创建一个触发器

create or replace trigger DEPT_TRIGAA(大写)
before insert on T_PERSON_DESC(表名) for each row
begin
select SEQ_T_DEPT.nextval into :new.PK_ID from dual;
end;