1、创建一个可以统计表格内记录条数的存储函数 ,函数名为count_sch()
create function count_sch( ) returns int begin declare c int default 0; select count(*) into c from sch; return c; end //
select count_sch()
2、创建一个存储过程avg_sai,有3个参数,分别是deptno,job,接收平均工资,
功能查询emp表dept为30,job为销售员的平均工资。
create procedure avg sai(in pl int, in p2 varchar(50),out p3 int) begin select avg(sai) into p3 from emp where deptno= pl and job = p2;end //