Задать вопрос
  • Ошибка синтаксиса SQL?

    @ValkyrieMadness Автор вопроса
    DELIMITER $$
    CREATE TRIGGER exh_locs_check
    BEFORE INSERT on exhibits
    FOR EACH ROW
    BEGIN
    DECLARE @exhibit_placements int;
    SET @exhibit_placements = (SELECT COUNT(*)  FROM exhibits
      JOIN collections_locations
      ON exhibits.id_коллекции = collections_locations.id_коллекции
      WHERE exhibits.id = new.id
        GROUP BY exhibits.id);
    IF (@exhibit_placements) = 0 THEN
      SIGNAL SQLSTATE '12345' SET MESSAGE_TEXT='Error';
      END IF;
    END$$
    DELIMITER ;


    5f06eae47f7b3949929184.png