This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

SQL Syntax Error -RAISERROR

I'm trying to create a trigger which raises an error when old password and new password are equal when updating it. However, I keep getting this error :

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '('TRY USING A PASSWORD NOT USED BEFORE',16,1);

here is my code:

DELIMITER //
CREATE TRIGGER PASSWORDTRIGGER 
BEFORE UPDATE ON CUSTOMER
FOR EACH ROW 
BEGIN
IF OLD.PASSWORD= NEW.PASSWORD  THEN
RAISERROR('TRY USING A PASSWORD NOT USED BEFORE',16,1);
END IF;
END //

Answer Answered by Ian Gilfillan in this comment.

As the error message indicates, you have a syntax error near the given string. RAISERROR is not MariaDB syntax. You might want to see SIGNAL.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.