要实现主键ID自动自增create or replace
trigger tib_distributionboxenergyinfo before insert
on DistributionBoxEnergyInfo for each row
declare
integrity_error exception;
errno integer;
errmsg char(200);
dummy integer;
found boolean;begin
select Sequence_1 INTO :new.ID from dual;exception
when integrity_error then
raise_application_error(errno, errmsg);
end;如上 序列已创建好了
一个表对应一个触发器 一个序列 表多的话有点麻烦 能共用的吗
实际开发中是每个表对应一个触发器吗 按效率来怎么设计好点
trigger tib_distributionboxenergyinfo before insert
on DistributionBoxEnergyInfo for each row
declare
integrity_error exception;
errno integer;
errmsg char(200);
dummy integer;
found boolean;begin
select Sequence_1 INTO :new.ID from dual;exception
when integrity_error then
raise_application_error(errno, errmsg);
end;如上 序列已创建好了
一个表对应一个触发器 一个序列 表多的话有点麻烦 能共用的吗
实际开发中是每个表对应一个触发器吗 按效率来怎么设计好点
公用触发器,这个还是第一次听说,从ORACLE给出的说明来看,一个触发器是附加在一个表上的,不太方便用,公用一个序列如果还不能满足的话可能要在ORACLE理写java/pro*c存储过程实现,或者在上层实现为好