- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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.
- 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?
- What are the advantages and disadvantages of using MySQL stored procedures?
- What are recursive stored procedures and why MySQL limits the recursion?
- How to get all the MySQL triggers and the triggers for only the current database
- What are QMF and SPUFI? What is the difference between them for accessing DB2 tables?
- What is stored procedure and how can we create MySQL stored procedures?
- What is the difference between MySQL stored procedure and function?
- What is the difference between EXECUTE IMMEDIATE and EXECUTE WITH PREPARE in DB2?
- What are the most significant differences between MySQL functions and procedures?