MySQL Forums
Forum List  »  Triggers

Prevent Insert With Trigger - How is it done?
Posted by: Frank Yingst
Date: March 08, 2017 01:43PM

Here is the trigger:
CREATE TRIGGER addressbook_upd_check BEFORE UPDATE ON addressbook
FOR EACH ROW
BEGIN
IF NEW.counselName = SUBSTRING(NEW.counselName,1,6) = 'Select' THEN
SIGNAL SQLSTATE '45000';
END IF;
END;

I then do this: INSERT INTO addressbook (counselName) values ('Select');

It adds the value to the table. How do I prevent the adding of the value to the table? I want to reject the value as if the INSERT statement was never issued.

Options: ReplyQuote


Subject
Views
Written By
Posted
Prevent Insert With Trigger - How is it done?
2852
March 08, 2017 01:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.