Advertisement
Dijuna

Attributes

Nov 5th, 2018
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.35 KB | None | 0 0
  1. CREATE DEFINER = CURRENT_USER TRIGGER `mydb`.`Secondaries_AFTER_INSERT` AFTER INSERT ON `Secondaries` FOR EACH ROW
  2. BEGIN
  3.     DECLARE c INT;
  4.     set c = (SELECT COUNT(*) FROM `Characteristics` WHERE `attribute_tag` = NEW.`attribute_tag`);
  5.     IF (c > 0) THEN BEGIN
  6.         DELETE FROM `Secondaries` WHERE `attribute_tag` = NEW.`attribute_tag`;
  7.     END; END IF;
  8. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement