如何在mysql中创建选择记录的过程?

如何在mysql中创建选择记录的过程?,mysql,stored-procedures,Mysql,Stored Procedures,如何在mysql中编写程序,从带有in和OUT参数的特定表中选择记录 delimiter // create procedure sample (in id int, out MyCount int) begin select count(*) into MyCount from YourTable where YourKey = id; end//

如何在mysql中编写程序,从带有in和OUT参数的特定表中选择记录

delimiter //

create procedure sample (in id int, out MyCount int)
begin
    select count(*) into MyCount 
        from YourTable 
        where YourKey = id;
end//