views:

164

answers:

3

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

Thank you

A: 

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

David Seiler
I am using Oracle
+2  A: 

Yes, like this:

create or replace trigger trg
after insert on emp
begin
   myproc(:new.empno, :new.ename);
end;
Tony Andrews
got it. it works. Thank you very much.
A: 

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.

StarShip3000