出现原因,是因为在更新的的表和读取的表是同一个表。 CREATE or replace TRIGGER T_userupdateT BEFORE update ON T_user REFERE
出现原因,是因为在更新的的表和读取的表是同一个表。
CREATE or replace TRIGGER T_userupdateT BEFORE update ON T_user REFERENCING OLD AS old NEW AS N_ROW FOR EACH ROW
DECLARE U_xtfidemp1 varchar(36);
u_xtempcode1 varchar(20);
u_xtempcodeCount int:=0;
U_xtfidempCount int:=0;
u_id1 int:=0;
BEGIN
U_xtfidemp1:=:N_ROW.U_xtfidemp;
u_xtempcode1:=:N_ROW.u_xtempcode;
u_id1:=:N_ROW.u_id;
select count(u_xtempcode) into u_xtempcodeCount from eas.T_user where u_xtempcode is not null and u_xtempcode=u_xtempcode1 and u_id<>u_id1;
select count(U_xtfidemp) into U_xtfidempCount from eas.T_user where U_xtfidemp is not null and U_xtfidemp=U_xtfidemp1 and u_id<>u_id1;
IF u_xtempcodeCount>0 or U_xtfidempCount>0 THEN
RaiSE_APPLICATioN_ERROR(-20001, 'eas.T_user u_xtempcode,U_xtfidemp,U_GZCode更新数据时有错误,有重复');
END IF;
end;
--结束END--
本文标题: Oracle触发器表发生了变化 触发器不能读它的解决方法(必看)
本文链接: https://www.lsjlt.com/news/52640.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0