STORED PROCEDURE Vs.A TRIGGER

A Stored procedure can be defined as a user defined code written in PL/SQL, which may or may not return a value when invoked by calling it explicitly.

Whereas, a Trigger can be defined as a stored procedure that runs automatically when an event (insert/update/delete) is occurred.

A Stored procedure can be called from inside another stored procedure.
But a Trigger cannot be directly called from within a trigger. One can only do nesting of triggers.

A Stored procedure is similar to a method in an object-oriented programming language.
On the other hand, Triggers are similar to event handlers in an object-oriented programming language.

A Stored procedure can be called from the front end files.
But one cannot call a Trigger from these files.

One can pass parameters to a Stored procedure.
But one can’t pass them to a Trigger.

Also, Stored procedures can return values.
But Triggers can’t return a value.

A Stored procedure is called directly by a user.
Whereas, a Trigger is not called directly by a user.

A Stored procedure is a group of SQL statements that is compiled one time, and then can be executed many times when required.

A Trigger is a database object that is implicitly fired when a triggering event occurs. The trigger can be executed before or after the triggering event.