Database triggers are PL/SQL code that executes based on event in the database. A trigger is an Oracle statement (or a group of statements enclosed within BEGIN and END statements) that are automatically executed by Oracle in response to any of these statements:
- ALTER
- CREATE
- DROP
- DELETE
- INSERT
- UPDATE
The last three are of the greatest interest—triggers that are executed in response to table row changes.
How to enable a trigger
To enable a database trigger do the following:
SQL> alter trigger [TRIGGERNAME] enable;
To enable all triggers from a table do the following:
SQL> alter table [TABLENAME] enable all triggers;
Dropping a trigger
To drop a trigger, use the DROP TRIGGER statement, as shown here:
SQL> drop trigger [TRIGGERNAME];