Difference between Trigger and Stored procedure in DBMS

Triggers

Stored Procedures

A Trigger is created in such a way that it fires when a specific event occurs. A group of sql commands that can be reused again and again are called stored procedures. They are created and stored in a database.
A trigger cannot be called or execute directly by a user.  Only when the corresponding events are fired, triggers are created. Stored procedures can be executed whenever wanted by using exec command.
Trigger cannot be scheduled. You can schedule a job to execute the stored procedure at a pre-defined time.
Calling a trigger within a trigger is not possible Calling a stored procedure within a stored procedure is possible
You cannot pass parameters as input. Inputs can be passed as parameters
 It does return a value Can return zero or n values.
In a trigger, we cannot perform any transactions You can use transactions within a stored procedure.

 

 

Leave a Reply

Your email address will not be published.

You May Also Like

What is ER Model in DBMS ?

ER stands for Entity-Relationship model. It is a high level data model. If any data elements or relationship of any specified system can defined using this model. Conceptual design for…
View Answer