0
觸發器在表如下的句法:錯誤限定SQLite中
CREATE TABLE "active_mtrs"
(
"mtr_ID" INTEGER PRIMARY KEY NOT NULL,
"status" INTEGER,
"NIrSTime" DATETIME,
"NIrETime" DATETIME
)
我所限定的觸發器爲:
CREATE TRIGGER "main"."replace1"
AFTER INSERT ON "active_mtrs" FOR EACH ROW
BEGIN
DECLARE @NIrSTime DATETIME;
DECLARE @NIrETime DATETIME;
DECLARE @mtr_ID INTEGER DEFAULT 0;
SELECT @mtr_ID = mtr_ID FROM INSERTED;
SELECT @NIrSTime = NIrSTime,@NIrETime = NIrETime
FROM subscriber
WHERE mtr_ID = @mtr_ID;
UPDATE active_mtrs
SET NIrSTime = @NIrSTime,
NIrETime = @NIrETime
WHERE mtr_ID = @mtr_ID;
END
其中subscriber
是在此數據庫中另一個表。
但我得到一個錯誤:
[ near "DECLARE": syntax error ]
Exception Name: NS_ERROR_FAILURE
Exception Message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
什麼是我的問題嗎?
謝謝,這是正確的 –