declare
totalcourgrade real;
begintotalcourgrade := GetCourseGrade('S07080101');select tb_grade.stuid 学号,stuname 姓名,sum(coursegrade) 已获学分 from tb_grade,tb_student where tb_student.stuid = tb_grade.stuid
group by tb_grade.stuid,stuname;dbms_output.put_line(totalcourgrade);
end;出现以下错误:
select tb_grade.stuid 学号,stuname 姓名,sum(coursegrade) 已获学分 from tb_grade,tb_student where tb_student.stuid = tb_grade.stuid
*第 7 行出现错误:
ORA-06550: 第 7 行, 第 1 列:
PLS-00428: 在此 SELECT 语句中缺少 INTO 子句
totalcourgrade real;
begintotalcourgrade := GetCourseGrade('S07080101');select tb_grade.stuid 学号,stuname 姓名,sum(coursegrade) 已获学分 from tb_grade,tb_student where tb_student.stuid = tb_grade.stuid
group by tb_grade.stuid,stuname;dbms_output.put_line(totalcourgrade);
end;出现以下错误:
select tb_grade.stuid 学号,stuname 姓名,sum(coursegrade) 已获学分 from tb_grade,tb_student where tb_student.stuid = tb_grade.stuid
*第 7 行出现错误:
ORA-06550: 第 7 行, 第 1 列:
PLS-00428: 在此 SELECT 语句中缺少 INTO 子句
totalcourgrade varchar2(20);
begin
totalcourgrade := 'S07080101';
dbms_output.put_line(totalcourgrade);
end;不知道你的 real 和 GetCourseGrade 是什么意思
如果要用select的话 如楼上说的 select a,b into A,B
dbms_output.put_line(A,B);
你可以上网查下嘛 pl/sql 不难
declare
totalcourgrade real;
begintotalcourgrade := GetCourseGrade('S07080101');for cur in (select tb_grade.stuid 学号,stuname 姓名,sum(coursegrade) 已获学分 from tb_grade,tb_student where tb_student.stuid = tb_grade.stuid
group by tb_grade.stuid,stuname) loop
dbms_output.put_line(cur.学号);
end loop;
dbms_output.put_line(totalcourgrade);
end;
declare
totalcourgrade real;
v_stuid tb_grade.stuid%type;
v_stuname varchar2(20);
v_num number;
cursor xsjc_cur is select tb_grade.stuid,stuname,sum(coursegrade) as coursegrade from tb_grade,tb_student where tb_student.stuid = tb_grade.stuid
group by tb_grade.stuid,stuname;
begin
totalcourgrade := GetCourseGrade('S07080101');
for xsjc_cur_rec in xsjc_cur loop
v_stuid:=xsjc_cur_rec.stuid;
v_stuname:=xsjc_cur_rec.stuname;
v_num:=xsjc_cur_rec.coursegrade;
dbms_output.put_line('学号:'||to_char(v_stuid),'姓名:'||v_stuname,'学分:'to_char(v_num));
end loop;
dbms_output.put_line(totalcourgrade);
end;