oracle中,在一个A存储过程中打开了游标,然后把游标传给B,C存储过程使用,在B中需要再次打开游标吗?
1个回答
2016-07-07
展开全部
create or replace procedure showstudent(v_cname in varchar) as
s_tmp number;
s_total number;
cursor cur_grade is select * from sc where c# in (select c# from c where cname = v_cname);
begin
for cur_rec in cur_grade loop
s_tmp := cur_rec.grade;
s_total := nvl(s_total, 0) + nvl(s_tmp, 0);
end loop;
dbms_output.put_line(v_cname || '的总分是: ' || s_total);
end;
s_tmp number;
s_total number;
cursor cur_grade is select * from sc where c# in (select c# from c where cname = v_cname);
begin
for cur_rec in cur_grade loop
s_tmp := cur_rec.grade;
s_total := nvl(s_total, 0) + nvl(s_tmp, 0);
end loop;
dbms_output.put_line(v_cname || '的总分是: ' || s_total);
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询