I'm trying to create a trigger to allow only one line per table. This database will be used by more than one software so I would like this automation to be done by the database.
Before the insert, the database should clean the previous register, plus the foreign tables.
At the moment I'm trying to clean the current table, but I'm having syntax errors
EDIT:
Try removing the begin/end:
CREATE TRIGGER before_insert_sensor BEFORE INSERT ON `sensor`
FOR EACH ROW
DELETE FROM sensor;
You might encounter issues trying to delete during the insert, though.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.