- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are TRIGGERS in DB2? What is the difference between TRIGGERS and STORED PROCEDURES?
The TRIGGERS are database programs which are triggered automatically by DBMS in response to any modification done on the specified table. A TRIGGER can be associated with only a single table and they cannot be skipped if the desired event occurs.
The TRIGGERS are like STORED PROCEDURES in the sense, both are pieces of code which are directly managed by DB2. However, TRIGGERS are event driven and executed automatically once the desired event occurs (INSERT/UPDATE/DELETE) on the specified table.
The STORED PROCEDURES on the other hand needs to be called explicitly in the application program. Another difference between them is, TRIGGERS are associated with only a single table but in case of STORED PROCEDURES we can use multiple tables.
The below blocks illustrate the functioning of STORED PROCEDURES and TRIGGERS.
The following are three important points which highlight the difference between TRIGGERS and STORED PROCEDURES.
- The STORED PROCEDURE returns the result or data from the database but TRIGGER only makes the changes in the database and does not return any data.
- The TRIGGERS are event driven, i.e., it activates whenever any changes are made in the database. However, the STORED PROCEDURES are not event driven.
- The TRIGGER can operate only on a single table (INSERT/UPDATE/DELETE); on the other hand the STORED PROCEDURE can operate on a multiple table.
- Related Articles
- Difference between stored procedure and triggers in SQL
- What are the differences between Stored procedures and functions?
- What are the privileges required to use triggers?
- What are Stored procedures in JDBC?
- What are the advantages, disadvantages and restrictions of using MySQL triggers?
- What are the advantages of stored procedures?
- What are stored procedures? How to call stored procedures using JDBC program?
- How to get all the MySQL triggers and the triggers for only the current database
- What are the advantages and disadvantages of using MySQL stored procedures?
- What are recursive stored procedures and why MySQL limits the recursion?
- What is stored procedure and how can we create MySQL stored procedures?
- What are QMF and SPUFI? What is the difference between them for accessing DB2 tables?
- In which order MySQL will invoke the triggers if we created multiple triggers of same event and action time?
- How can we see the information on triggers order in case of multiple triggers\nfor same event and action time?
- Explain about triggers and active databases in DBMS
