6

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

Thank you

4

4 回答 4

12

是的,像这样:

create or replace trigger trg
after insert on emp
for each row
begin
   myproc(:new.empno, :new.ename);
end;
于 2009-11-10T17:01:15.183 回答
2

是的,您可以从触发器触发过程。但是,请记住,触发器和过程不应该访问同一个表。

于 2013-07-11T15:50:15.600 回答
1

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".

于 2009-11-10T16:50:23.047 回答
1

是的你可以。请记住,触发器可以针对受 DML 触发器影响的每一行触发。所以你的存储过程应该被优化,否则你可能会遇到性能问题。触发器是一件好事,但您只需要记住使用它们时可能出现的性能问题。

于 2009-11-10T17:03:28.113 回答