Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
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;





VB
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'  ) );






ERROR:

SQL execution error #1065. Response from the database:
Query was empty
Posted

1 solution

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; 


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]
 
Share this answer
 
Comments
[no name] 6-Feb-14 0:25am    
Its not working
CoderPanda 6-Feb-14 0:27am    
That's not very helpful. Did you try to get what gets passed into stmt1 at run time?
[no name] 6-Feb-14 0:29am    
I dont know how to check that at runtime
CoderPanda 6-Feb-14 0:33am    
Well then you need to study a bit about debugging a stored proc in MySQL. Downvoting solutions don't really help.

Try these:
http://stackoverflow.com/a/19540798/2671089
http://www.drdobbs.com/database/debugging-mysql-stored-procedures/218100564?pgno=2
[no name] 6-Feb-14 1:21am    
It did not help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900