请帮忙 !!我在SP中收到错误,但记录正在保存 [英] Please Help !! I am getting error in SP, But records are getting saved

查看:268
本文介绍了请帮忙 !!我在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]


这篇关于请帮忙 !!我在SP中收到错误,但记录正在保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆