I am trying to create a trigger to simply delete records from systables_growth
table before an insert happens based on the where clause used on the date_added
column for records older than a certain number of days (in this example, 15 days):
I am using the below:
CREATE TRIGGER systables_growth_clnup
INSERT ON systables_growth
DELETE FROM systables_growth
WHERE date_added < (CURRENT - 15 UNITS DAY)
I am getting the below syntax error when performing the above.
CREATE TRIGGER systables_growth_clnup
INSERT ON systables_growth
DELETE FROM systables_growth
#^
# 201: A syntax error has occurred.
#
WHERE date_added < (CURRENT - 15 UNITS DAY)