Mysql trigger to block a row delete

Posted by rtacconi on Stack Overflow See other posts from Stack Overflow or by rtacconi
Published on 2010-04-01T16:00:21Z Indexed on 2010/04/01 16:03 UTC
Read the original article Hit count: 285

Filed under:
|

I wuold like to define a trigger to block the deletion of the row with ID 2 of the configuration table, you might guess why, I am trying something like that:

CREATE TRIGGER do_not_delete_configuration_1 BEFORE DELETE ON configuration
  FOR EACH ROW BEGIN
    IF (OLD.configurationid != 1) THEN
      DELETE FROM configuration WHERE configuration.configuration=OLD.configurationid;
    END IF;
  END;
|

without a positive result.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about triggers