ORACLE 数据库库表设置主键自增

创建主键自增长策略:

create sequence logging_event_id
minvalue 1
nomaxvalue
start with 1
increment by 1
nocycle

设置触发事件:

create or replace trigger T_SYS_USER_USER_ID_TRIGGER
before insert on logging_event  
for each row
begin
select logging_event_id.nextval into :new.event_id from dual;
end T_SYS_USER_USER_ID_TRIGGER;


-- logging_event  表名
-- event_id 列名
 

猜你喜欢

转载自blog.csdn.net/ShenDaiSun/article/details/103637645
今日推荐