Triggers are stored programs that automatically execute in response to events like data manipulation language (DML) statements or database definition (DDL) statements. Triggers are created using a CREATE TRIGGER statement that specifies the trigger name, timing (BEFORE, AFTER, INSTEAD OF), triggering event (INSERT, UPDATE, DELETE), and trigger body with optional declaration and executable statements. The document demonstrates creating a table with triggers that execute before an UPDATE and DELETE statement to the table.
Triggers are stored programs that automatically execute in response to events like data manipulation language (DML) statements or database definition (DDL) statements. Triggers are created using a CREATE TRIGGER statement that specifies the trigger name, timing (BEFORE, AFTER, INSTEAD OF), triggering event (INSERT, UPDATE, DELETE), and trigger body with optional declaration and executable statements. The document demonstrates creating a table with triggers that execute before an UPDATE and DELETE statement to the table.
Triggers are stored programs that automatically execute in response to events like data manipulation language (DML) statements or database definition (DDL) statements. Triggers are created using a CREATE TRIGGER statement that specifies the trigger name, timing (BEFORE, AFTER, INSTEAD OF), triggering event (INSERT, UPDATE, DELETE), and trigger body with optional declaration and executable statements. The document demonstrates creating a table with triggers that execute before an UPDATE and DELETE statement to the table.
Triggers are stored programs, which are automatically executed or fired when some events occur. Triggers are, in fact, written to be executed in response to any of the following events: A database manipulation (DML) statement (DELETE, INSERT, or UPDATE). A database definition (DDL) statement (CREATE, ALTER, or DROP). A database operation (SERVERERROR, LOGON, LOGOFF, STARTUP, or SHUTDOWN).
Syntax for creating a trigger is:
CREATE [OR REPLACE] TRIGGER trigger_name {BEFORE | AFTER | INSTEAD OF} {INSERT [OR] | UPDATE [OR] | DELETE} [FOR EACH ROW] WHEN (condition) DECLARE Declaration-statements BEGIN Executable-statements END;
Abhay Jit Chauhan
13BCS1008
Creating a table and triggers.
Abhay Jit Chauhan
13BCS1008
Now when Update query is run the trigger display_sal is
executed before it.
And when Delete query is run the trigger del is executed before it.