请帮忙 !!我在SP中收到错误,但记录正在保存
CREATE PROCEDURE Student_InsertTimeLine(
_studentUserCode varchar(300),
_userFrom varchar(300),
_userTo varchar(300),
_operation varchar(300),
_msgTitle varchar(4000),
_activity varchar(4000)
)
BEGIN
SET @strTblQuery = CONCAT(INSERT INTO,_ studentUserCode,_ Timeline(studentUserCode,userfrom,userto,operation,MessageTitle,activity,dateCreated)VALUES(' ,_studentUserCode,',',_ userFrom,',',_ userTo,',',_ operation,',',_ msgTitle,',',_ activity,',',现在, (),'));
PREPARE stmt1 FROM @strTblQuery;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
END;
CREATE PROCEDURE Student_InsertTimeLine(
_studentUserCode varchar(300),
_userFrom varchar(300),
_userTo varchar(300),
_operation varchar(300),
_msgTitle varchar(4000),
_activity varchar(4000)
)
BEGIN
SET @strTblQuery = CONCAT("INSERT INTO " , _studentUserCode ,"_Timeline (studentUserCode,userfrom,userto,operation,MessageTitle,activity,dateCreated) VALUES('",_studentUserCode,"','", _userFrom ,"','", _userTo ,"','", _operation ,"','",_msgTitle,"','", _activity ,"','",NOW(),"')");
PREPARE stmt1 FROM @strTblQuery;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
END;
CALL Student_InsertTimeLine('UA78', 'BP11', 'UA78',
'Attendance','Attendance', concat_ws(' ','Attendance Taken On ', '2013-07-01', '. Attendance Status: ','Full Absent', ' for Class: ', 'PUCCL-01', ', Section: ', 'First Batch' ) );
错误:
SQL执行错误#1065。来自数据库的响应:
查询为空
ERROR:
SQL execution error #1065. Response from the database:
Query was empty
在实际查询以某种方式附加后,还有一个分号。
尝试输入日志或注释行,看看在此行之前形成的实际查询是什么:
There is an additional semicolon after the actual query being appended somehow.
Try putting a log or comment line to see what is the actually query formed right before this line:
EXECUTE stmt1;
对不起,我无法尝试,因为我现在没有安装MySQL。希望能帮助到你。
[请接受/投票给你的答案或解决方案,以鼓励他人]
Sorry, I can not try it as I don't have a MySQL installation right now. Hope it helps.
[Please accept/up-vote answers or solutions that work for you to encourage others]