我试图弄清楚如何将删除语句放在 SQLite 触发器的条件中。
我想出了这个示例代码:
CREATE TRIGGER mytrigger
BEFORE INSERT ON mytable
BEGIN
SELECT CASE WHEN
1 == 1
THEN
DELETE FROM mytable
END;
END;
但它无法编译:
Error: near "DELETE": syntax error
如果我用 替换DELETE FROM mytable
,RAISE(FAIL, "mytrigger was activated")
它编译得很好。