On 12/12/2014 2:38 PM, Alexander Syvak wrote:
How is actually a function done internally in MySQL after CREATE FUNCTION
Why can't there be a dynamic SQL inside a function?
Sorry for the delay.
The answer is embedded in this description of what is or is not allowed
within a function:
Stored functions may not contain statements that perform explicit or implicit commit or rollback. Support for these statements is not required by the SQL standard, which states that each DBMS vendor may decide whether to permit them.
Since we cannot easily restrict the types of commands generated by
dynamic SQL within a function, we simply disallowed those as part of the
This and several other restrictions for functions are also listed here
The gist of all of these restrictions is that a FUNCTION shall create
the least side effects possible while generating the result value.
MySQL Senior Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
Office: Blountville, TN
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql