How are STORED PROCEDURES different than TRIGGERS in the MySQL world ?
A trigger is defined to activate when an INSERT, DELETE, or UPDATE statement executes for the associated table. A stored procedure is a group of Transact-SQL statements compiled into a single execution plan.
A: Yes, we can call stored procedure inside the trigger.
What is the difference between Triggers and Stored Procedure? Stored Procedures are called by the programmer wherever it wants to fire but triggers fired automatically when insert,delete,update occured. And triggers can be implemented to tables & views only where as stored procedure used in the database independently.
Stored procedures can accept parameters and can return values. Triggers can neither accept parameters nor return values. A Trigger is dependent on a table and the application has no control to not fire a trigger when not needed. On the other hand, a stored procedure can be called as needed.
Stored procedures are stored as precompilated code (stored routine) and called by the programmer wherever it wants to fire. Stored procedure can return value(s). About procedures and functions.
Triggers are named database objects fired automatically when insert, delete, update (or other event) occurred, there can be no explicit invocation. Trigger can not return any data. About triggers.
You can use procedures in trigger's code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With