0
請幫助這個MySQL觸發器 - 已經搜索並找不到語法問題。mySQL觸發第二張表
錯誤#1064 - 您的SQL語法錯誤;檢查與您的MySQL服務器版本相對應的手冊,以在'@v_index int DEFAULT 1; WHILE @v_index < = NEW.pt_number INSERT INTO專利」在行9
DELIMITER $$
CREATE TRIGGER after_insert_calls_insert_patients
AFTER INSERT ON Calls
FOR EACH ROW
BEGIN
DECLARE @v_index int DEFAULT 1;
WHILE @v_index <= NEW.pt_number
INSERT INTO Patients SET
Patient_id = CONCAT(NEW.Calls_id, '-', @v_index),
FK_Calls_id = NEW.Calls_id,
update_by = "SYSTEM";
SET @v_index := @v_index +1;
END WHILE;
END;
$$
DELIMITER ;