DELIMITER $$
CREATE TRIGGER example
BEFORE INSERT ON dates FOR EACH ROW
BEGIN
declare age int;
IF ((set age = AND (select * , year(curdate())-year(dob) ) < 18)
THEN
CALL `'Cannot add or update row: only one active row allowed per type'`;
END IF;
END;
$$