0

I am using this to prevent any delete from MySQL table user

delimiter //
CREATE TRIGGER tr_no_del BEFORE DELETE on user
FOR EACH ROW SET
BEGIN
    UPDATE user SET a=0;
END;//
delimiter ;

But mysql is giving some syntax error, any ideas what i am missing here?

Thanks!

1
  • FOR EACH ROW SET should be FOR EACH ROW instead, as mentioned by @catalinetu. But you should ever include the error message you get, so we know with what problem we're confronted. Commented Aug 4, 2014 at 18:55

1 Answer 1

1

try this one

DELIMITER //

DROP TRIGGER IF EXISTS tr_no_del//

CREATE TRIGGER tr_no_del BEFORE DELETE ON `user`
FOR EACH ROW 
BEGIN
    UPDATE USER SET a=0;
END;//
DELIMITER ;
Sign up to request clarification or add additional context in comments.

6 Comments

error: #1235 - This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
@user2955412 Well then remove this existing trigger first.
mysql version: 5.1.73-cll - MySQL Community Server (GPLv2)
can you check if there are other triggers?
try with this to view the triggers on user table SHOW TRIGGERS WHERE table = user; and with this to view the events from current database SHOW EVENTS FROM database;
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.