Is there any way that I could use trigger instead of check? like I have
CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGERtest
BEFORE UPDATE ONapply
FOR EACH ROW BEGIN IF NEW.cname = "hi" THEN
SET NEW.cname = "hello";
ELSE
RETURN 1;
END IF;
END; $$
but return 1 doesn't work. Is there anyway that I can prevent the query from executing?
Best Answer
You do not need a
RETURN 1
because Trigger is a Stored Procedure, not a Stored Function.If you want to break it on purpose, that's acceptable.
I wrote two posts about how to break a trigger midstream
Try this: