بتاريخ: 24 أبريل 200916 سنة comment_154592 [DEPT COURSE# PRE_ PRE_COURSE#---- ---------- ---- -----------CS 432 CS 240CS 532 CS 432Math 314 Math 221CS 432 Math 314CS 552 CS 2405. Write a procedure in your package that, for a given course (with dept_code and course# as parameters), can return all its prerequisite courses (show dept_code and course# together as in CS532), including both direct and indirect prerequisite courses.If course C1 has course C2 as a prerequisite, C2 is a direct prerequisite. If C2 has course C3 has a prerequisite, then C3 is an indirect prerequisite. Indirect prerequisites can be more than two levels away. تقديم بلاغ
بتاريخ: 24 أبريل 200916 سنة كاتب الموضوع comment_154632 No answer?Anyway thanks . I solve it. and I will post my solution for general benefit.and it's working. set serveroutput on set echo on create or replace procedure show_pre (deptc in courses.dept_code%type,cour# in courses.course#%type) is cursor c2 is select (p1.pre_dept_code||p1.pre_course#) as CID from prerequisites p1 where p1.dept_code=deptc and p1.course#=cour#; begin for c2_rec in c2 loop dbms_output.put_line(c2_rec.CID); declare cursor c3 is select (p2.pre_dept_code||p2.pre_course#) as CID from prerequisites p2 where (p2.dept_code||p2.course#)=c2_rec.CID; begin for c3_rec in c3 loop dbms_output.put_line(c3_rec.CID); end loop; end; end loop; end; / show errors exec show_pre('CS',432); Salam Alakoum Samer تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.