Hi,

I'm trying to write a trigger but I'm having problems. Because SQLite itself
doesn't enforce FK constraints I'd like to do this myself using a trigger
and I tried the following, but I'm not getting there,

CREATE TRIGGER Insert_Active BEFORE INSERT ON Active
FOR EACH ROW BEGIN
SELECT CASE
WHEN (SELECT COUNT(*) FROM Friends WHERE Login = new.Login) = 0
THEN RAISE(FAIL, "Login is not found in the database.")
ELSE DELETE FROM Disable WHERE Login = new.Login
END;
END;

The error I'm getting,

SQL error: near "DELETE": syntax error

Any help is appreciated!

Thanks!


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to