首页 新闻 会员 周边 捐助

mysql 执行动态sql语句

0
悬赏园豆:40 [已关闭问题] 关闭于 2011-10-08 20:57

set @a = 0;
'select @i = count(1) from config‘
set @a = @i;
意思就是运行这么一个动态的sql语句,要把@i赋值给存储过程的变量

 

以下是我问题代码

create procedure AAAAAAAAAAAA(out totalItem int)
begin


DECLARE s1 varchar(2000);
set @i = 2;

PREPARE s1 from ' set ?:=count(1) from gameorder where id=?';
execute s1 using @i;

set totalItem = @i;

end

 

如果觉得我说的不清楚的,请联系QQ282873744

农民(it)的主页 农民(it) | 菜鸟二级 | 园豆:205
提问于:2011-10-08 19:54
< >
分享
所有回答(1)
0

drop procedure if exists AAAAAAAAAAAA;
delimiter $$
create procedure AAAAAAAAAAAA(out totalItem int)
begin


DECLARE s1 int;
set @i = 99;

PREPARE s1 from ' select count(1) into @i from gameorder';
execute s1;

set totalItem = @i;


end$$
delimiter ;

农民(it) | 园豆:205 (菜鸟二级) | 2011-10-08 20:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册