Oracle Triggers Category:
1. Statement triggers
2, row triggers
3. System Condition Trigger
4. User event triggers
5. INSTEAD of Triggers
1. Statement triggers
is a specific statement or a trigger on a statement group that executes on a table or on a view in some cases. The ability to insert, UPDATE,
Delete or associate on a combination. However, no matter what combination is used, the individual statement triggers are activated only once for the specified statement
。 For example, an UPDATE statement trigger is invoked only once, regardless of how many rows are being update.
Example:
Users who perform DML operations on a table need to be checked for appropriate privileges.
Create Table Foo (a number);
Create Trigger Biud_foo
Before insert or UPDATE or delete
on Foo
Begin
If user not in (' DONNY ') then
Raise_application_error ( -20001, ' don ' t have access to modify this table. ');
End If;
End;
/
Even Sys,system users cannot modify the Foo table
Test
Log the time and character of the modified table.
1, the establishment of the test table
CREATE TABLE employees_copy as select *from hr.employees
2, the establishment of the log table
CREATE TABLE Employees_log (
Who Varchar2 (30),
When date);