Run the procedure in the trigger

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

thanks

+6
sql oracle stored-procedures execute
source share
4 answers

Yes, like this:

create or replace trigger trg after insert on emp for each row begin myproc(:new.empno, :new.ename); end; 
+10
source share

Yes, you can start the procedure from a trigger. But keep in mind that trigger and procedure e should not have the same table.

+2
source share

In SQL Server, this is so. What DBMS do you use?

ETA: Oracle, huh? I have no personal experience, but that seems to indicate that you can. I found this by googling the "stored Oracle launch procedure".

+1
source share

Yes, you can. Just keep in mind that a trigger can fire for every line affected by a DML trigger. Therefore, your stored procedure must be optimized or you may run into performance issues. Triggers are good, but you just need to keep in mind the performance issues that you might encounter when using them.

+1
source share

All Articles