SQL 在触发器中执行过程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1709399/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Execute procedure in a trigger
提问by user207902
Is it possible to execute a stored procedure inside a trigger?
是否可以在触发器内执行存储过程?
Thank you
谢谢
回答by Tony Andrews
Yes, like this:
是的,像这样:
create or replace trigger trg
after insert on emp
for each row
begin
myproc(:new.empno, :new.ename);
end;
回答by Manish Dubey
Yes you can fire a procedure from a Trigger. But, keep in mind that trigger & procedur e should not acess the same table.
是的,您可以从触发器中触发程序。但是,请记住触发器和过程不应访问同一个表。
回答by David Seiler
回答by Kuberchaun
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.
是的你可以。请记住,触发器可以为受 DML 触发器影响的每一行触发。所以你的存储过程应该被优化,否则你可能会遇到性能问题。触发器是一件好事,但您只需要记住使用它们时可能出现的性能问题。