Configuración de la tabla de la base de datos ORACLE Incremento automático de la clave principal

Cree una estrategia de crecimiento personal clave principal:

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

Establecer evento desencadenante:

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 列名

 

 

Supongo que te gusta

Origin blog.csdn.net/ShenDaiSun/article/details/103637645
Recomendado
Clasificación