delimiter //
drop procedure if exists queryCount//
create procedure queryCount(out cnt int)
begin
declare count int;
select count(*) into count from table_xxx;
set cnt = count;
end
//
delimiter ;
代码里面,其实可以直接select count(*) into cnt的,因为我想试试它的赋值操作,所以用了一个中间变量。