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;

1 つのカーソルを使用して、学生が特定の学位を取得するために必要なすべてのコースを一覧表示しています。学生が勉強している学位取得に合格したコースの数をリストする 2 番目のカーソル。両方のカーソルの両方の値が等しい場合、彼は終了試験を受ける資格があります。そうでない場合、彼はできません。比較コードを書き留めましたが、上記は正しい方法ではないと思います。

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 に答える