Is it possible to execute a stored procedure inside a trigger?
Thank you
Is it possible to execute a stored procedure inside a trigger?
Thank you
是的,像这样:
create or replace trigger trg
after insert on emp
for each row
begin
myproc(:new.empno, :new.ename);
end;
是的,您可以从触发器触发过程。但是,请记住,触发器和过程不应该访问同一个表。
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".
是的你可以。请记住,触发器可以针对受 DML 触发器影响的每一行触发。所以你的存储过程应该被优化,否则你可能会遇到性能问题。触发器是一件好事,但您只需要记住使用它们时可能出现的性能问题。