1

I am getting an error in my mySql query when i execute my create trigger query in mysql using phpmyadmin which is provided below.

Error:

enter image description here

Error Message :

#1064 - 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 5

MySql Query:

CREATE TRIGGER Trigger_INSERT_club_app_member_contact_info After INSERT ON club_app_member_contact_info
FOR EACH ROW
BEGIN
  INSERT INTO club_app_events_list(type_id,event_title,event_description,event_date,event_time,event_venue)
              values(1,CONCAT('Happy Birthday ',NEW.title,NEW.name),NEW.mobile_no,NEW.dob,'8.30AM','');
  IF NEW.ismarried == 'Yes' THEN
          INSERT INTO club_app_events_list(type_id,event_title,event_description,event_date,event_time,event_venue)
                      values(1,CONCAT('Happy Birthday ',NEW.title_for_spouse,NEW.nameOf_spouse,'Spouse of (',NEW.title,NEW.name,')'),NEW.spouse_mobileNo,NEW.spouse_dob,'8.30AM','');
          INSERT INTO club_app_events_list(type_id,event_title,event_description,event_date,event_time,event_venue)
                      values(2,CONCAT('Happy Wedding Anniversary to ',NEW.title,NEW.name ,' & ',NEW.title_for_spouse,NEW.nameOf_spouse),NEW.mobile_no,NEW.weeding_date,'8.30AM','');      
  END IF
END

I don't know what's wrong with my query.Can anyone help me to find a solution.

9
  • 1
    few thing i noticed IF NEW.ismarried == 'Yes' THEN it should IF NEW.ismarried = 'Yes' THEN BEGIN and END IF should end with semicolon ; although BEGIN end enclose END; Commented Sep 21, 2017 at 9:49
  • But still it is not working Commented Sep 21, 2017 at 9:52
  • if you are using phpmyadmin then please use // Delimiter for pl/sql functions, procedures or triggers. rest all looking fine Commented Sep 21, 2017 at 9:58
  • @Girish How can i do that.? Because i am new to mysql It would be better if you show an example. Commented Sep 21, 2017 at 10:00
  • 1
    Great, you would using >=5.6 mysql server version, Although this is only phpmyadmin analysis warnings not a mysql server response. Commented Sep 21, 2017 at 10:18

1 Answer 1

1

Few thing i noticed IF NEW.ismarried == 'Yes' THEN it should IF NEW.ismarried = 'Yes' THEN BEGIN and END IF should end with semicolon ; although BEGIN end enclose END;

But since i am trying to execute this query using phpmyadmin I have to remove Delimiter from the bottom text box of phpmyadmin. But note that this is only phpmyadmin analysis warnings not a mysql server response.

Sign up to request clarification or add additional context in comments.

Comments

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.