Priyank Patel
Priyank Patel

Reputation: 81

When Creating Trigger I got Error #1064 in Mysql 5

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 6 

My Trigger

CREATE TRIGGER `register_notification_after_register`
`AFTER INSERT ON register FOR EACH ROW BEGIN
Set @notification = CONCAT('New Member Register. Membership Code is',' ',new.membership_no,'.');
Set @notificationfor =CONCAT('New Membership');
call notification_masterAddUpdate(1,@notification,@notificationfor,new.reg_date,1); 
END

Upvotes: 0

Views: 30

Answers (1)

Drew
Drew

Reputation: 24949

try this:

DELIMITER $$
CREATE TRIGGER `register_notification_after_register`
AFTER INSERT ON register FOR EACH ROW BEGIN
Set @notification = CONCAT('New Member Register. Membership Code is',' ',new.membership_no,'.');
Set @notificationfor =CONCAT('New Membership');
call notification_masterAddUpdate(1,@notification,@notificationfor,new.reg_date,1); 
END
$$ -- I am done server, end of block
DELIMITER ;

you had an extra backtick on line two. One needs to set the DELIMITER to block the whole thing. With create event, create stored proc, create trigger, delimiters clue the server into when the whole chunk is done. Remember that the ; ends a statement. The delimiter statement suspends that in favor of something else, then resets at end of block

Upvotes: 2

Related Questions