首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

储蓄过程变量有关问题

2012-03-16 
储蓄过程变量问题createproceduretest(intblvarchar(32),outcntint(11))begin/*这里怎么写执行类似selectc

储蓄过程变量问题
create   procedure   test(   in   tbl   varchar(32),out   cnt   int(11)   )
begin
/*
这里怎么写执行类似
select   count(*)   into   cnt   from   {$tbl};
的语句
*/
end

[解决办法]
参考:

create procedure countNum
(
in tbName varchar(100),
out allPages int
)
begin
set @sqlStr = CONCAT( 'select count(*) into @allPages from ',tbName);
prepare sqlstmt from @sqlStr;
execute sqlstmt;

set allPages = @allPages;

deallocate prepare sqlstmt;
end;
[解决办法]
http://blog.chinaunix.net/u/29134/showart_255219.html

热点排行