TRIGGERS

suggest change

Syntax

CREATE
[DEFINER = { user | CURRENT_USER }]
TRIGGER trigger_name
trigger_time trigger_event
ON tbl_name FOR EACH ROW
[trigger_order]
trigger_body

Remarks

Two points matter if you already use triggers on other databases:

FOR EACH ROW

FOR EACH ROW is a mandatory part of the syntax

You cannot make a statement-level trigger (once per statement) as Oracle does. MySQL triggers are row-level only.

CREATE OR REPLACE TRIGGER

The CREATE OR REPLACE is not supported by MySQL

MySQL does not allow that syntax. Drop the old trigger and create it again:

DELIMITER $$

DROP TRIGGER IF EXISTS myTrigger;
$$
CREATE TRIGGER myTrigger
-- ...

$$
DELIMITER ;

Be careful, this is not an atomic transaction :

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents