1个回答
展开全部
create or replace procedure (ave out number,themax out number,themin varchar2)is
Mathmax number;
Mathmin number;
chinesemax number;
chinesemin number;
englishmax number;
englishmin number;
totle number;
sum1 number;
sum2 number;
sum3 number;
count1 number;
begin
select Math into Mathmax from score where 1=1 order by desc;
select Math into Mathmin from score where 1=1 order by asc;
select chinese into chinesemin from score where 1=1 order by asc;
select chinese into chinesemax from score where 1=1 order by desc;
select english into englishmax from score where 1=1 order by desc;
select english into englishmin from score where 1=1 order by asc;
---the max
if Mathmax>chinesemax then
themax:=Mathmax;
else
themax:=chinesemax;
end if;
if themax > englishmax then
themax:=themax;
else
themax:=englishmax;
end if;
---the min
if Mathmin>chinesemin then
themin:=chinesemin;
else
themin:=Mathmin;
end if;
if themin > englishmin then
themin:=englishmin;
else
themin:=themin;
end if;
--the average
select count(1) into count1 from score;
select sum(math) into sum1 from score;
select sum(chinese) into sum2 from score;
select sum(english) into sum3 from score;
ave:=(sum1+sum2+sum3)/count1;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |