简体   繁体   中英

What's wrong with this MySQL trigger?

So what is wrong with this trigger? MySQL is only nice enough to tell me it is a 1064 error.

DELIMITER |

CREATE TRIGGER new_member BEFORE INSERT on member
FOR EACH ROW BEGIN
    INSERT INTO party(PartyId, PartyTypeCode, DateCreated, DateUpdated) 
     VALUES(New.PartyId, ’M’,now(), now());
END;
|

DELIMITER ;

I'd guess that your problem is the non-ASCII quotes in your VALUES :

VALUES(New.PartyId, ’M’,now(), now());
-- -----------------^

Try using plain old single quotes like SQL expects:

VALUES(New.PartyId, 'M', now(), now());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM