ERROR 1336 (0A000): Dynamic SQL is not allowed in stored function or trigger
2012-05-08 15:19
726 查看
Dynamic SQL is not allowed in stored function or trigger
关于 mysql 的这个错误: 导致的原因是 :
1. 在function或者是trigger里面执行了动态sql语句。
2. 是在function或者是trigger里面调用了含有动态sql语句的存储过程
单独在存储过程里面执行动态sql语句是没有问题的。
解决的办法:
目前最新的mysql版本来说 function trigger还是不支持 动态sql语句的。
当然可以绕开数据库 用应用程序来解决是最好的了。
要是硬要用数据库的办法来解决的话 :(以function为例子)
我的办法是 :
1. 生成一张存储 function 所执行的所有语句到临时表中(包括调用其他procedure产生的ddl ,dml语句)
(此时的过程返回的结果 应该也是以字符串的格式 将产生的ddl ,dml语句插入到临时表中去)
2. 遍历顺序执行临时表
相关文章推荐
- ERROR 1336 (0A000): Dynamic SQL is not allowed in stored function or trigger
- ERROR 1336 (0A000): Dynamic SQL is not allowed in stored function or trigger
- mysql触发器报错 1422 Explicit or implicit commit is not allowed in stored function or trigger.
- Error 1313: RETURN is only allowed in a FUNCTION SQL Statement
- ERROR 1442 (HY000): Can\'t update table \'sign\' in stored function/trigger because it is already used by statement which invoke
- sql --it is not contained in either an aggregate function or the GROUP BY clause.
- Error 1313: RETURN is only allowed in a FUNCTION SQL Statement
- error: DynamicDataSource is not abstract and does not override abstract method getParentLogger() in
- SQL Error (1130): Host IP is not allowed to connect to this MySQL server
- MySQL触发器更新本表数据异常:Can’t update table ‘tbl’ in stored function/trigger because it is already used by s
- ERROR spi.SqlExceptionHelper : 'Infinity' is not a valid numeric or approximate numeric value 问题解决
- MySQL触发器更新本表数据异常:Can't update table 'tbl' in stored function/trigger because it is already used by statement which invoked this
- Can't update table 'tbl' in stored function/trigger because it is already used by statement which invoked this stored function/t
- Code Sign Error in Xcode. resource fork, Finder information, or similar detritus not allowed
- About Derby "ERROR 42X51: The class '***' does not exist or is inaccessible. This can hap pen if the class is not public."
- [Solved]: System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use.
- Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
- (三)Jetson TK1安装opencv-2.4.9,可能的问题error: a storage class is not allowed in an explicit specialization
- Uncaught (in promise) TypeError: __webpack_require__.i(...) is not a function
- ERROR: index 'test1': sql_connect: Host 'maoyt3' is not allowed to connect to this MySQL server (DSN