Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute procedure in a trigger

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

Thank you

like image 719
user207902 Avatar asked Nov 10 '09 16:11

user207902


3 Answers

Yes, like this:

create or replace trigger trg
after insert on emp
for each row
begin
   myproc(:new.empno, :new.ename);
end;
like image 144
Tony Andrews Avatar answered Sep 23 '22 11:09

Tony Andrews


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

like image 38
Manish Dubey Avatar answered Sep 24 '22 11:09

Manish Dubey


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.

like image 36
Kuberchaun Avatar answered Sep 22 '22 11:09

Kuberchaun