TRIGGERS

suggest change

Syntax

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

Remarks

Two points need to draw your attention if you already use triggers on others DB :

FOR EACH ROW

FOR EACH ROW is a mandatory part of the syntax

You can’t make a statement trigger (once by query) like Oracle do. It’s more a performance related issue than a real missing feature

CREATE OR REPLACE TRIGGER

The CREATE OR REPLACE is not supported by MySQL

MySQL don’t allow this syntax, you have instead to use the following :

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