当前位置:首页 > 数据库 > 正文

ORACLE数据库id自增

2020-03-02 数据库

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;

 

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/SQL/22000.html