CodePudding user response:
The general idea is as follows:The create or replace the trigger flip-flop name
After the insert on the table name
For each row
Declare
N number;
The begin
If inserting then
Select count (0) into n from need comparison table name t where t. student id=: new. Student id;
If n=0 then
Related table insert new data operations, such as: insert into the table name (field name... ) values (the corresponding field name... );
The else
Response of delete operations, such as: delete the table name the where condition,
End the if;
end if;
End the trigger name;