Bug #31201 Stored Procedures now can contain prepared Statements.
Submitted: 26 Sep 2007 11:01 Modified: 14 Nov 2007 0:17
Reporter: Sveta Smirnova
Status: Closed
Category:Server: Docs Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Paul DuBois Target Version:
Triage: D4 (Minor)

[26 Sep 2007 11:01] Sveta Smirnova
Description:
Our manual says at http://dev.mysql.com/doc/refman/5.1/en/routine-restrictions.html:

 Stored routines cannot contain arbitrary SQL statements. The following statements are
disallowed:
***
    *      SQL prepared statements (PREPARE, EXECUTE, DEALLOCATE PREPARE). Implication:
You cannot use dynamic SQL within stored functions or triggers (where you construct
dynamically statements as strings and then execute them). 

But they are allowed.

How to repeat:
See bug #31161

Suggested fix:
Fix manual
[14 Nov 2007 0:17] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The
updated documentation will appear on our website shortly, and will be included in the
next release of the relevant products.

The manual is correct, actually, because it states that the restriction is for stored
functions and triggers. That is, prepared statements are allowed in stored *procedures*.
However, this distinction isn't so clear in the item in question, so I will attempt to
clarify it.