赞
踩
我试图写一个接受受害者和他们的人数的程序。victims
参数将包含像这样的值'123,321,222',我正在使用一个函数
调用SPLIT_STR_FUNCTION将文本分割为逗号分隔值。然后我
会在数据库中插入每个值。
这里是我的程序:
CREATE DEFINER=`root`@`localhost` PROCEDURE `InsertPost`( in pmsg text, in pthumbPath text, in ppath text, in puserid bigint, in count int, in victims text)
BEGIN
INSERT INTO posts(path,thumbpath,msg,userid) VALUES(ppath,pthumbpath,pmsg,puserid);
SET @lastpostid = (SELECT postid FROM posts ORDER BY postid DESC LIMIT 1);
SET @startindex=1;
WHILE @startindex <= count DO
SET @IndividualIDs=convert((select SPLIT_STR_Function(victims, ',', @startindex)),signed);
SET @startindex=startindex+1;
INSERT INTO victims(victimid,postid) VALUES(@IndividualIDs,@lastpostid);
end WHILE;
END错误:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。