【发布时间】:2020-02-18 12:35:30
【问题描述】:
我在plsql中开发了一个触发器,触发器工作但我同时收到了6封邮件。我只需要一封邮件,我该怎么办?
CREATE or replace TRIGGER RI
AFTER insert or update on ap_supplier_sites_all
for each row
DECLARE
x_count NUMBER;
begin
select count(*) into x_count
from rib1 r1,rib2 r2
where r1.ATTRIBUTE4=r2.Supplier_RIB;
if(x_count > 0)
then
testrib;--execute SP
end if;
end;
【问题讨论】:
-
像@littlefoot 建议的那样切换到 after 语句 触发器是正确的如果您必须使用触发器,但请考虑将电子邮件生成移回应用程序代码。如果在提交事务或用户取消(回滚)事务之前发生错误,会发生什么情况。您的更新电子邮件已发送,但更新未进入数据库。
标签: oracle plsql oracle11g sendmail database-trigger