MySQL Forums
Forum List  »  MySQL Workbench

xpost from triggers: create before insert, mysqlworkbench: the object's DDL contains syntax error
Posted by: Kenneth Christensen
Date: December 06, 2020 01:50AM

CREATE DEFINER = CURRENT_USER TRIGGER family2.family_members_BEFORE_INSERT BEFORE INSERT ON family_members FOR EACH ROW
BEGIN
select p.birth_date
into new.person_join_date
from people as p
where p.people.id = new.people_people_id;
END;

or

CREATE DEFINER = CURRENT_USER TRIGGER family2.family_members_BEFORE_INSERT BEFORE INSERT ON family_members FOR EACH ROW
BEGIN
declare dob date;
select p.birth_date
into dob
from people as p
where p.people.id = new.people_people_id;
new.people_people_id := dob;
END;

Can you spot the syntax error? I can't.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.