我试图写下面的触发器:
CREATE TRIGGER SightingLocationError
AFTER INSERT ON SIGHTINGS
WHEN LOCATION NOT IN FEATURES
BEGIN
RAISE(ABORT,
'ERROR: Insert into SIGHTINGS table references location' + LOCATION + 'that is not found in the database.'
);
END;
但它抛出了这个错误:
sql> CREATE TRIGGER SightingLocationError
AFTER INSERT ON SIGHTINGS
WHEN LOCATION NOT IN FEATURES
BEGIN
RAISE(ABORT,
'ERROR: Insert into SIGHTINGS table references location' + LOCATION + 'that is not found in the database.'
);
END
[2017-12-02 13:25:12] [1] [SQLITE_ERROR] SQL error or missing database (near "RAISE": syntax error)
我尝试过不同的方式格式化字符串并更改查询,但无论我尝试什么,我都会遇到同样的错误。任何人都可以告诉我我的代码有什么问题吗?