MySQL trigger is only activated by statement. You cannot write two triggers to the same event of the same table. The same event refers to the trigger _
MySQL trigger is only activated by statement. You cannot write two triggers to the same event of the same table. The same event refers to the trigger _
The MySQL trigger is only activated by statement and cannot write two triggers for the same event of the same table. The same event refers to trigger_time + trigger_event in the create trigger. trigger will not be activated because of changes to some tables. The changes to these tables are modified using APIs that do not send statements to mysql server.
1. mysql can only trigger each row once, while Oracle can trigger the whole table of each row once.
2. mysql can only be a row activation trigger for tables, but oracle can trigger columns.
Definitions of triggers in oracle:
CREATE
[Or replace] trigger_name trigger_time trigger_event of column
ON tbl_name referencing old as old_value
New as new_value
For each row trigger_stmt
Mysql trigger Definition Statement:
CREATE
[DEFINER = {user | CURRENT_USER}]
TRIGGER trigger_name trigger_time trigger_event
ON tbl_name for each row trigger_stmt
A simple test is as follows:
Mysql> delimiter |
Mysql> create trigger test_a before insert on
-> FOR EACH ROW BEGIN
-> Insert into abc SET id = NEW. id;
->
-> END;
-> |
Query OK, 0 rows affected (0.00 sec)
Mysql> delimiter;
Mysql>
Mysql>
Mysql> delimiter |
Mysql> create trigger test_ B BEFORE INSERT ON
-> FOR EACH ROW BEGIN
-> Insert into abc SET name = NEW. name;
->
-> END;
-> |
ERROR 1235 (42000): This version of MySQL doesn't yet support 'Multiple triggers with the same action time and event for one table'
Mysql> delimiter;
Mysql>
Mysql>
Mysql> delimiter |
Mysql> create trigger test_ B AFTER INSERT ON
-> FOR EACH ROW BEGIN
-> Insert into abc SET name = NEW. name;
->
-> END;
-> |
Query OK, 0 rows affected (0.00 sec)