17,377
社区成员
发帖
与我相关
我的任务
分享
1 create or replace procedure pro(v_avg in number)
2 is
3 begin
4 for i in (select studname,studno,avg(studscore) a,count(courseid) b
5 from t group by studname,studno having avg(studscore) > v_avg)
6 loop
7 dbms_output.put_line(i.studname||' : '||i.studno||' : '||i.a||' : '||i.b);
8 end loop;
9* end pro;
SQL> /
警告: 创建的过程带有编译错误。
create or replace procedure pro(v_avg in number)
is
begin
for i in (select studname,studno,avg(studscore) a,count(courseid) b
from t group by studname,studno having avg(studscore) > v_avg) loop
dbms_output.put_line(i.studname||' : '||i.studno||' : '||i.a||' : '||i.b);
end loop;
end pro;
/
create or replace procedure pro(v_avg in number)
is
begin
for i in (select studname,studno,avg(studscore) a,count(courseid) b
from t group by studname,studno having avg(studscore) > v_avg)
loop
dbms_output.put_line(i.studname||' : '||i.studno||' : '||i.a||' : '||i.b);
end loop;
end pro;
1 create or replace procedure pro(v_avg in number)
2 is
3 begin
4 for i in (select studname,studno,avg(studscore) a,count(courseid) b
5 from t group by studname,studno having avg(studscore) > v_avg)
6 dbms_output.put_line(i.studname||' : '||i.studno||' : '||i.a||' : '||i.b);
7* end pro;
8 /
警告: 创建的过程带有编译错误。
create or replace procedure proc(p_score in number)
as
begin
for cur1 in (select * from (select t.*,avg(studscore)over(partition by studno)ag from score t)
where ag>p_score)
loop
dbms_output.put_line(cur1.studname||' '||cur1.studno||' '||cur1.studsex||' '||cur1.courseid||' '||cur1.studscore);
end loop;
end proc;
select studno,studname,avg(studscore),count(courseid)
from tab
group by studno,studname
having avg(studscore)>'参数'
create or replace procedure pro(v_avg in number)
is
begin
for i in (select studname,studno,avg(studscore) a,count(courseid) b
from t group by studname,studno having avg(studscore) > v_avg)
dbms_output.put_line(i.studname||' : '||i.studno||' : '||i.a||' : '||i.b);
end pro;