储蓄过程变量有关问题

储蓄过程变量问题

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

储蓄过程变量有关问题

相关文章:

你感兴趣的文章:

标签云: