Oracle触发器表发生了变化 触发器不能读它的解决方法(必看)
发布时间:2020-12-12 17:06:59 所属栏目:百科 来源:网络整理
导读:出现原因,是因为在更新的的表和读取的表是同一个表。 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
出现原因,是因为在更新的的表和读取的表是同一个表。 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;出现错误时,是因为触发器在T_userupdateT在T_user上,触发器内部有读取了T_user所以有错误。 修改如下 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,有重复'); END IF; COMMIT; end;多了PRAGMA AUTONOMOUS_TRANSACTION;COMMIT;两句 以上这篇Oracle触发器表发生了变化 触发器不能读它的解决方法(必看)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |