create or replace function display_grade(
v_sno students_grade.student_id%type,
v_cno students_grade.student_id%type
)
return number
as
v_score students_grade.score%type;
begin
select score into v_score from students_grade where students_grade.student_id=v_sno and students_grade.course_id=v_cno;
return v_score;
exception
when no_data_found then
dbms_output.put_line('该学生或该门课程不存在');
end;
--以上是我写的一函数display_grade,当我用如下代码调用该函数时,报错了:PL/SQL 函数未返回值,不知道为什么,请
各位帮忙解答,谢谢!declare
begin
dbms_output.put_line('成绩为:'||display_grade(10101,10102));
end;
v_sno students_grade.student_id%type,
v_cno students_grade.student_id%type
)
return number
as
v_score students_grade.score%type;
begin
select score into v_score from students_grade where students_grade.student_id=v_sno and students_grade.course_id=v_cno;
return v_score;
exception
when no_data_found then
dbms_output.put_line('该学生或该门课程不存在');
end;
--以上是我写的一函数display_grade,当我用如下代码调用该函数时,报错了:PL/SQL 函数未返回值,不知道为什么,请
各位帮忙解答,谢谢!declare
begin
dbms_output.put_line('成绩为:'||display_grade(10101,10102));
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货