salix/db/routines/vn/triggers/town_beforeInsert.sql

10 lines
263 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`town_beforeInsert`
BEFORE INSERT ON `town`
FOR EACH ROW
BEGIN
SET NEW.geoFk = zoneGeo_new('town', NEW.`name`,
(SELECT geoFk FROM province WHERE id = NEW.provinceFk));
END$$
DELIMITER ;