1
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;

我正在使用一个光标列出学生需要为特定学位学习的所有课程。第二个光标列出学生已经通过了多少门课程以获得他正在学习的学位。如果两个光标中的两个值相等,他将有资格参加退出考试,否则他将无法参加。我已经写下了比较代码,但我认为上面不是正确的方法。

4

1 回答 1

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;

我想出了我的问题的答案,它对我来说非常有效:))

于 2012-11-05T06:02:31.817 回答