Oracle 触发器的使用小结
程序员文章站
2023-12-04 19:14:22
--建递增序列 create sequence lzeam_sp_loop_eq_seq minvalue 1 increment by 1 start with 1 测试...
--建递增序列
create sequence lzeam_sp_loop_eq_seq minvalue 1 increment by 1 start with 1
测试:
select lzeam_sp_loop_eq_seq.nextval from dual
--建触发器
create or replace trigger lzeam.lzeam_sp_loop_eq_trigger before insert on sp_loop_eq for each row begin select lzeam.lzeam_sp_loop_eq_seq.nextval into :new.loop_eq_code from dual; end;
--查触发器
select * from user_triggers;
/**启/禁用触发器*/
alter table sp_loop_eq disable all triggers alter table sp_loop_eq enable all triggers
create sequence lzeam_sp_loop_eq_seq minvalue 1 increment by 1 start with 1
测试:
select lzeam_sp_loop_eq_seq.nextval from dual
--建触发器
create or replace trigger lzeam.lzeam_sp_loop_eq_trigger before insert on sp_loop_eq for each row begin select lzeam.lzeam_sp_loop_eq_seq.nextval into :new.loop_eq_code from dual; end;
--查触发器
select * from user_triggers;
/**启/禁用触发器*/
alter table sp_loop_eq disable all triggers alter table sp_loop_eq enable all triggers