LEAVE
needs a label. See the LEAVE documentation and the sample in the LOOP documentation. Also, you need to terminate your LEAVE
statement with a semicolon.
MySQL doesn't appear to have any official examples for LEAVE
within a trigger. This blog post puts the label right before the BEGIN
. Based on that, try something like this:
DROP TRIGGER IF EXISTS greentrucks.iCustomer;
DELIMITER GO
CREATE TRIGGER greentrucks.iCustomer AFTER INSERT
ON customer
For each ROW
my_label: BEGIN
DECLARE count int;
SET @count = FOUND_ROWS();
If @count = 0
THEN LEAVE my_label;
... and the rest of your code