Execute procedure in a trigger

本秂侑毒 提交于 2019-11-29 20:32:03

问题


Is it possible to execute a stored procedure inside a trigger?

Thank you


回答1:


Yes, like this:

create or replace trigger trg
after insert on emp
for each row
begin
   myproc(:new.empno, :new.ename);
end;



回答2:


Yes you can fire a procedure from a Trigger. But, keep in mind that trigger & procedur e should not acess the same table.




回答3:


Yes you can. Just keep in mind that a trigger can fire for every row affected with a DML trigger. So your stored procedure should be optimized or you could will run into performance issues. Triggers are a good thing but you just have to keep in mind the performance issues that can come up when using them.




回答4:


In SQL Server it is. What DBMS are you using?

ETA: Oracle, eh? I've no personal experience with it, but this seems to indicate that you can. I found it by googling "oracle trigger stored procedure".



来源:https://stackoverflow.com/questions/1709399/execute-procedure-in-a-trigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!