Introduction: triggerIt is a special stored procedure. Trigger execution is not triggered by a program or manually, but by an event,Oracle DatabaseIt is a database system that everyone is very familiar with. What is the syntax of Oracle triggers? The following sections will provide detailed analysis for you.
ORACLE triggers
The syntax for ORACLE to generate database triggers is:
Create [or replace] trigger name trigger time trigger event
On Table Name
[For each row]
Pl/SQL statements
Where:
Trigger name: name of the trigger object. Because the trigger is automatically executed by the database, the name is only a name and has no substantive purpose.
Trigger time: specifies when the trigger is executed. This value is optional:
Before --- indicates that the trigger is executed before the database action;
After --- indicates that the logpilot executes the database action.
Trigger event: Specifies which database actions will trigger this trigger:
Insert: This trigger is triggered when the database is inserted;
Update: This trigger is triggered when the database is modified;
Delete: This trigger is triggered when a database is deleted.
Table Name: The table where the database trigger is located.
For each row: the trigger for each row of the table is executed once. If this option is not available, the entire table is executed only once.
For example, the following trigger is triggered before the table auths is updated to prevent table modification on weekends:
Create trigger auth_secure
Before insert or update or delete file: // triggered before update of the entire table
On auths
Begin
If (to_char (sysdate, 'dy ') = 'sun'
RAISE_APPLICATION_ERROR (-20600, 'table auths' cannot be modified on weekends ');
(RAISE_APPLICATION_ERROR is a function within the Arc. The first parameter range is-20000 ~ Between 20999 and the second
The parameter is a string with a size of 2 k. If the parameter is exceeded, the system automatically truncates it)
End if;
End
The syntax knowledge of Oracle database Triggers described above is not comprehensive. If you are interested in this knowledge, in the future, I will continue to introduce more detailed knowledge to you, hoping to help you.