1

I am trying to add mysql trigger using the upgradeschema in magento 2 but I am getting the "Cannot execute multiple queries". Below is my trigger

DELIMITER $$

CREATE TRIGGER customerdata_insert_before 
BEFORE INSERT 
ON customerdata
FOR EACH ROW BEGIN
IF (NEW.longitude IS NULL) THEN
  SET NEW.longitude = `00.000000`;
END IF;
IF (NEW.latitude IS NULL) THEN
  SET NEW.latitude = `00.000000`;
END IF;
  SET NEW.geo_point = Point(NEW.latitude, NEW.longitude);
END;
$$
DELIMITER ;

Please Help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.