declare
course_id char(10);
course_idA char(10);
cursor task3
is
select c_id from certificationrequirement
where pcp_id = 101;
cursor task3A
is
select o.c_id from courseoffering o
join co_enrolment ce
on o.co_id = ce.co_id
where ce.s_regno = 401 and ce.coe_completionstatus = 'P';
Begin
open task3;
DBMS_OUTPUT.PUT_LINE ( 'List of Course to take ');
loop
FETCH task3 into course_id;
exit when task3%NOTFOUND;
DBMS_OUTPUT.PUT_LINE ( course_id);
end loop;
close task3;
open task3A;
DBMS_OUTPUT.PUT_LINE ( 'List of Courses student has passed ');
loop
FETCH task3A into course_idA;
exit when task3A%NOTFOUND;
DBMS_OUTPUT.PUT_LINE (course_idA);
end loop;
close task3A;
if (cursor task3 = cursor task3A )
Then
DBMS_OUTPUT.PUT_LINE ( 'Student can attempt the Certification exam ');
Else
DBMS_OUTPUT.PUT_LINE ( 'Student cannot attempt the Certification exam ');
END if;
end;
我正在使用一个光标列出学生需要学习的特定学位课程。 第二个光标列出了他正在学习的学位课程。 如果光标中的两个值都相等,他将有资格参加退出考试,否则他将无法参加。我已经写下了比较代码,但我认为上面不是正确的方法。
答案 0 :(得分:0)
if (task3%rowcount = task3A%rowcount )
Then
DBMS_OUTPUT.PUT_LINE ( 'Student can attempt the Certification exam ');
Else
DBMS_OUTPUT.PUT_LINE ( 'Student cannot attempt the Certification exam ');
END if;
我找到了我的问题的答案,这对我来说非常有用:))