What Is A Trigger?
What Is A Trigger?
database server.
Once the stored procedure has been "stored", client applications can execute the stored
procedure over and over again without sending it to the database server again and without
compiling it again.
Stored procedures improve performance by reducing network traffic and CPU load.
What is a Trigger?
A database trigger is procedural code that is automatically executed in response to certain events
on a particular table in a database. Triggers can restrict access to specific data, perform logging,
or audit access to data.
There are two classes of triggers, they are either "row triggers" or "statement triggers". With row
triggers you can define an action for every row of a table, while statement triggers only occur
once and are not dependent on the shape of the data.
Each class can be of several types. There are "BEFORE triggers" and "AFTER triggers" which
alters the time of execution of the trigger. There is also an "INSTEAD OF trigger" which is a
conditional trigger that will fire instead of the triggering statement.
There are typically three triggering EVENTS that cause trigger to 'fire':
• INSERT event (as a new record is being inserted into the database).
• UPDATE event (as a record is being changed).
• DELETE event (as a record is being deleted).
Databases that support triggers typically give programmers access to record variables by means
of a syntax such as :OLD.cust_name or :NEW.cust_name. e.g. if a trigger is monitoring for
changes to a salary field one could write a trigger.
Oracle 9i allows you to create triggers on schemas and databases also.You can create a trigger
for creating or altering or dropping a schema object.Triggers can also be created for logging in
and logging out of databases.
Schema Level Triggers
• Before Create
• After Create
• Before Alter
• After Alter
• Before Drop
• After Drop
• After Logon
• Before Logoff
The major features and effects of database triggers are that they:
http://www.scribd.com/full/35917?access_key=hecr63dsuf95v