我的查询在Workbench中工作正常:
select @sql := `query` from `resultado` where `idregistracion` = 10000030 limit 1;
select @sql;
prepare stmt from @sql;
execute stmt;
deallocate prepare stmt;
但它在MySQL存储过程中不起作用:
delimiter $$
drop procedure if exists run_queries$$
create procedure run_queries(IN idRegistracion bigint)
begin
select idRegistracion;
select @sql := `query` from `resultado` where `idregistracion` = 10000030 limit 1;
prepare stmt from @sql;
execute stmt;
deallocate prepare stmt;
end$$
当我尝试执行呼叫时
call run_queries(10000030);
MySQL给我这个错误信息:
错误代码:1064您的SQL语法出错;检查与MySQL服务器版本对应的手册,以便在第1行的“NULL”附近使用正确的语法
有人知道为什么吗?
我使用MySQL Workbench 6.3,MySQL 5.1.53-community-log,感谢您的建议!