Có điều kiện nếu/trường hợp/khi câu lệnh được hỗ trợ trong trình kích hoạt sqlite không?câu lệnh chèn có điều kiện trong các kích hoạt sqlite
ta hãy nói rằng tôi có các thiết lập sau:
CREATE TABLE someTable (id INTEGER PRIMARY KEY, someValue INTEGER);
CREATE TRIGGER update_another_table AFTER INSERT ON someTable
BEGIN
IF(new.someValue==0)
DELETE FROM another_table WHERE (...some condition);
ELSE
IF NOT EXISTS(SELECT anotherValue FROM another_table WHERE anotherValue =new.someValue)
INSERT INTO another_table VALUES(new.someValue, ...);
ELSE
UPDATE another_table SET anotherValue = new.someValue;
END;
Nhưng nó tăng một lỗi cú pháp Sqlite error near 'IF': syntax error"