Proper syntax for "CASE WHEN ... THEN ... DELETE ... END" in SQLite triggers?
I'm trying to figure out how to put a delete statement inside a
conditional in an SQLite trigger.
I've come up with this code:
CREATE TRIGGER mytrigger
BEFORE INSERT ON mytable
BEGIN
SELECT CASE WHEN
1 == 1
THEN
DELETE FROM mytable
END;
END;
But it fails with:
Error: near "DELETE": syntax error
If I replace DELETE FROM mytable with RAISE(FAIL, "mytrigger was
activated"), it compiles fine.
No comments:
Post a Comment