php - How to return error Message in Output from Trigger? -


I am trying to create a trigger that ensures that the same shop_id 3 times, and If the user tries to add more than 3 records for the same shop_id , then it will throw an error message. I wrote the following trigger but giving me an error message

  if (totals (different (shop_id)) 3) SET MESSAGE_TEXT: = 'You can not insert more than 3 records; end if;   

This is giving me an error message.

  MySQL said: # 1064 - There is an error in your SQL syntax; Check the Manual related to your MySQL server version for the correct syntax to use the nearest 'SET MESSAGE_TEXT: =' check to force   

Please check this and guide me that I What's wrong here?

Enter image details here

< Div class = "post-text" itemprop = "text">

  signal SQLSTATE '45000' SET MESSAGE_TEXT = 'You can not insert more than 3 records;   



Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -