What is a trigger? Explain the working of BEFORE and AFTER triggers.

What will be an ideal response?

A database trigger, known simply as a trigger, is a PL/SQL block. It is stored in the
database and is called automatically when a triggering event occurs. A user cannot call a trigger explicitly. The triggering event is based on a Data Manipulation Language statement such as INSERT, UPDATE, or DELETE. A trigger can be created to fire before or after the triggering event.  The BEFORE trigger is fired before execution of a DML statement. The BEFORE trigger
is useful when you want to plug in some values in a new row, to insert a calculated column into a new row, or to validate a value in the INSERT query with a lookup in another table. An AFTER trigger fires after a DML statement is executed. It utilizes the built-in Boolean functions INSERTING, UPDATING, and DELETING. If the triggering event is one of the three DML statements, the function related to the DML statement returns TRUE and the other two return FALSE. For example, if the current DML statement is INSERT, then INSERTING returns TRUE, but DELETING and UPDATING return FALSE.

Computer Science & Information Technology

You might also like to view...

The Internet2 is much faster than the Internet because it has a fiber optic backbone instead of a mixture of telephone cables and fiber optics

Indicate whether the statement is true or false

Computer Science & Information Technology

All of the following statements are TRUE regarding PivotTable and PivotChart best practices EXCEPT:

A) Format the PivotTable or PivotChart so it is easy to read and your audience understands what it is you are trying to communicate. B) Once you have selected your data, ensure the source data are arranged in an area with column headings representing each field and the rows representing each record. C) Distinguish fields as either grouping variables or slicer variables. D) Know who your audience is prior to developing your PivotTable or PivotChart. It could make a difference in how much detail you display.

Computer Science & Information Technology