first mysql trigger failing -
OK, I have started writing my first trigger in mysql, it does not give any error, but it is not Either work ...
DELIMITER $$ DROP TRIGGER `cc`.update_expires_date_trig $$$ Create trigger` update_expires_date_trig` Update INSERT on` credit_test_acc` for each line Update credit_ct_acc SET date_expires_acc = DATE_ADD (CURDATE (), INTERLAL 6 months) WHERE type_ac = 'root' end; $$ DELIMITER; I have 2 problems:
-
The table 'credit_test_acc' can not be updated in the stored function / trigger because it has already Is used by
-
Is the defined trigger just going to update the required line or every row in the database?
As far as I know, to do this work It should be rewritten to work relatively hard:
DELIMITER $$ DROP TRIGGER `cc`.`update_expires_date_trig` $$` Trigger 'before `INR2' for each rev to 'credit_test_acc' Update_expires_date_trig create SEND NEW.date_expires_acc = DATE_ADD (CURDATE (), interval 6 months) END; $$ DELIMITER; Where the new table references the row to be inserted, you have not given any role, what type of role 'type_acc' can play here (I guess more than one way So I have left it, if it is that I think it is, you can apply it like this:
if new .type_acc = 'init' then # Whatever you want
Comments
Post a Comment