0

I have a problem when creating a trigger in mysql i get this error:

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

This is my first time creating triggers for mysql help

Here is the code:

        CREATE TRIGGER insertAfterUser AFTER INSERT ON MEMBERS    
        FOR EACH ROW    
        BEGIN    
        INSERT INTO blagajna (MemberId,StanjeRacuna) VALUES(12,0.0);    
        END;

2 Answers 2

1

You need to set the delimiter

delimiter //
CREATE TRIGGER insertAfterUser AFTER INSERT ON MEMBERS    
      FOR EACH ROW    
      BEGIN    
      INSERT INTO blagajna (MemberId,StanjeRacuna) VALUES(12,0.0);    
      END;//
delimiter ;
Sign up to request clarification or add additional context in comments.

Comments

1
CREATE TRIGGER `insertAfterUser ` BEFORE INSERT ON `members` FOR EACH ROW BEGIN INSERT INTO   blagajna (MemberId,StanjeRacuna) VALUES('12','0.0'); END;                         

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.