Bug #69113 script working perfectly having sytex error
Submitted: 1 May 2013 12:13 Modified: 1 May 2013 16:53
Reporter: Rami Jamleh Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:5.6.11-log OS:Windows (7 ultimate SP1)
Assigned to: CPU Architecture:Any
Tags: prepared statements, sytex error

[1 May 2013 12:13] Rami Jamleh
Description:
running this script 

SET @did = CEIL(RAND()*(SELECT MAX(id) FROM drawing)); 
SET @cidCount = CEIL(RAND()*(SELECT COUNT(*) FROM checklist_revision));
SET @s := 'SET @cid := (select cid from checklist_revision limit ?,1)';
PREPARE st3 FROM @s; 
EXECUTE st3 USING @cidCount; 

INSERT INTO checklist_drawing VALUES(@cid,@did, FLOOR(rand()*5)) ON DUPLICATE KEY
UPDATE cid = @cid;

DEALLOCATE st3;
-------------------------------------------------------------
gives sytex error  HOWEVER THE PROBLEM IS IT WORKS AS EXPECTED 

THE ERROR IS 

/* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'st3' at line 1 */

as you can see no st3 at line one but (it works) 
cid is assigned a value noting that it's a foreign key one-to-one 

if i had an error in st3 the statement shouldn't be prepared in the first place 

thank you 

How to repeat:
when executing the script
[1 May 2013 13:30] Rami Jamleh
Same thing over here (other tables)

SET @did = CEIL(RAND()*(SELECT MAX(id) FROM drawing)); 
SET @sidCount = CEIL(RAND()*(SELECT COUNT(*) FROM shopdrawing_revision));
SET @s := 'SET @sid := (select sid from shopdrawing_revision limit ?,1)';
PREPARE st3 FROM @s; 
EXECUTE st3 USING @sidCount; 

INSERT INTO shopdrawing_submiteddrawings VALUES(@sid,@did, FLOOR(rand()*5),ceil(rand()*2)) ON DUPLICATE KEY
UPDATE sid = @sid;

DEALLOCATE st3;
[1 May 2013 16:27] MySQL Verification Team
"DEALLOCATE st3;"

is that is wrong syntax.  Surely you mean:

"DEALLOCATE PREPARE st3;
http://dev.mysql.com/doc/refman/5.6/en/deallocate-prepare.html
[1 May 2013 16:53] Rami Jamleh
Sorry for bothering 

thanks