触发器
oracle 触发器的问题:没提交成功也会消耗一个id号;不能在插入成功后才触发。
oracle使用了触发器id自增时,插入语句有id也会被替换掉
insert into table(ID,name) values(123,name); --123会被触发器使用序列替换了。就是用户不能用自己的值。
这种有什么办法吗
create or replace trigger tri_SM_MESSAGE_RECEIVER_id
before insert
on sm_message_receiver
for each row
declare
-- local variables here
begin
select SEQ_SM_MESSAGE_RECEIVER_ID.nextval into :new.id from dual; --多个分号不行;
end tri_SM_MESSAGE_RECEIVER_id;