0
我想知道是否有人可以幫助我將預更新觸發器從MySQL轉換爲SQLite。下面是MySQL的觸發器:將MySQL觸發器轉換爲SQLite
CREATE TRIGGER trigger_name
BEFORE UPDATE ON `table_name`
FOR EACH ROW
BEGIN
IF (NEW.fk IS NOT NULL AND NEW.status < 50)
THEN
BEGIN
DECLARE obj_count INT(11);
SELECT COUNT(*)
INTO obj_count
FROM (SELECT id FROM table_name
WHERE `status` < 50 AND fk = NEW.fk
LIMIT 1) AS objs;
IF (obj_count > 0)
THEN
SIGNAL SQLSTATE '23000' SET MESSAGE_TEXT = "Error.";
END IF;
END;
END IF;
END
我undesrstanding是信號聲明需要重寫這樣的:SELECT RAISE(ABORT, 'Error.')
但也有,我有一個很難理解其他語法錯誤。