2017-02-25 43 views
0

無法運行此聲明兩個處理程序的SQLSTATE

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行

回答