Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Experiment-10

AIM- Triggers in PL/SQL


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.

Abhay Jit Chauhan

13BCS1008

You might also like