0
DELIMITER $$
CREATE TRIGGER tr_test BEFORE UPDATE ON test
FOR EACH ROW
BEGIN
DECLARE EXIT HANDLER FOR SQLSTATE '45000';
DECLARE EXIT HANDLER FOR SQLSTATE '23000';
IF(older_record(NEW.last_action_timestamp, OLD.last_action_timestamp)) THEN
SET @rowhash = (SELECT MD5(NEW));
INSERT INTO test_db.test_table SELECT NEW.*, @rowhash;
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'old record';
END IF
END
$$
DELIMITER ;
我得到以下錯誤信息:
您的SQL語法錯誤;檢查與您的> MariaDB服務器版本相對應的手冊,以獲取在''附近使用的正確語法'; DECLARE EXIT HANDLER FOR SQLSTATE'23000'; IF(older_record(NEW.l」 4行
我編輯問題以實施您的解決方案,但我仍然收到錯誤 –
再次刺傷。 –