MySQL Forums
Forum List  »  Triggers

Trigger for read-only column
Posted by: Fitsum Tesfagiorgis
Date: June 12, 2013 07:53AM

I am trying to make one of my table's column read-only and I created the following triggers but i am getting a syntax error.

CREATE TRIGGER client_id_lock before
UPDATE
ON
reeher_dash_dbo.users_column_lock FOR EACH row BEGIN IF OLD.client_id THEN SIGNAL SQLSTATE '45000'
SET
MESSAGE_TEXT = 'Cannot update locked record';
END IF;
END;


I got the following error
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6
mysql> END IF;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END IF' at line 1
mysql> END;

did I miss anything?

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger for read-only column
2803
June 12, 2013 07:53AM
1721
June 12, 2013 09:25AM
1642
June 15, 2013 09:46AM


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.