mysql> delimiter $$
mysql> create procedure s2(in in_name varchar(11),out out_age int)
-> begin
-> select age into out_age from emp_new where name=in_name;
-> end $$
mysql> delimiter ;
mysql> call s2('张三',@age);
mysql> select @age;
mysql> delimiter //
mysql> create procedure s1()
-> begin
-> select name,incoming from emp_new;
-> end //
# 测试
mysql> delimiter ;
mysql> call s1();
mysql> delimiter //
mysql> create procedure s3(in in_dept int, out avg_sal float)
-> begin
-> select avg(incoming) into avg_sal from emp_new where dept2=in_dept;
-> end //
mysql> delimiter ;
mysql> call s3(101,@sal);
mysql> select @sal;