Create or replace
Trigger
"User_trigger"
After insert
Or delete
Or update
On users
-- Three trigger events
For each row -- Row-Level Trigger
Begin
If inserting
Then
Insert into users2
Values (: New
. Lid,: New. strname,: New. straddress );
Elsif deleting
Then
Delete from users2
Where users2.lid =: Old. lid;
Elsif updating
Then
Update users2
Set users2.strname =: New. strname, users2.straddress =: New. straddress where users2.lid =: Old
. Lid;
End if;
End;
1. Which of the insert/update/delete triggers the trigger, you can use the inserting/updating/deleting condition predicate in the trigger for judgment.
2. New and: Old: Must be for Row-level triggers. That is to say, the triggers using these two variables must have for each row.
These two variables are the array variables automatically provided by the system: New is used to record the newly inserted value, and old is used to record the deleted value;
When using insert, only values in new are available;
When using Delete, only values in old are available;
When update is used, values in new and old are available;