我正在尝试在 MySQL 中创建一个存储过程,但它给了我一个语法错误。
这是查询:
delimiter //
create procedure PostToTimeline (in txt text, in BY int, in FORR int)
begin if BY = FORR then
insert into posts (Body,UserID_BY,UserID_FOR) values(txt,BY,FORR);
else
insert into posts (Body,UserID_BY,UserID_FOR)
select txt, friends.UserID,friends.FriendID
from friends where friends.UserID = BY and friends.FriendID = FORR;
end//
delimiter;
什么是问题?