Updating clause used in instead of trigger

Posted by / 14-Jul-2017 14:47

Updating clause used in instead of trigger

A trigger normally exists in the same database as the table named after the "ON" keyword in the CREATE TRIGGER statement.Except, it is possible to create a TEMP TRIGGER on a table in another database.Both the WHEN clause and the trigger actions may access elements of the row being inserted, deleted or updated using references of the form "NEW.column-name" and "OLD.column-name", where column-name is the name of a column from the table that the trigger is associated with.OLD and NEW references may only be used in triggers on events for which they are relevant, as follows: If a WHEN clause is supplied, the SQL statements specified are only executed if the WHEN clause is true.Because of the behaviors described above, programmers are encouraged to prefer AFTER triggers over BEFORE triggers.

FOR EACH ROW implies that the SQL statements specified in the trigger may be executed (depending on the WHEN clause) for each database row being inserted, updated or deleted by the statement causing the trigger to fire.When defining a TEMP trigger on a non-TEMP table, it is important to specify the database holding the non-TEMP table.Creates a trigger, which is a type of stored procedure that is often used for enforcing integrity constraints.Instead, executing an INSERT, DELETE or UPDATE on the view causes the associated triggers to fire.The real tables underlying the view are not modified (except possibly explicitly, by a trigger program).

updating clause used in instead of trigger-58updating clause used in instead of trigger-29updating clause used in instead of trigger-78

If no WHEN clause is supplied, the SQL statements are executed every time the trigger fires.