Home » SQL & PL/SQL » SQL & PL/SQL » cursor in condition rule(if..elsif...end if;)
cursor in condition rule(if..elsif...end if;) [message #4489] Sat, 14 December 2002 11:35 Go to next message
medoc
Messages: 3
Registered: December 2002
Junior Member
DECLARE

alert number;
luck integer(1);

cursor ailec is
select metric_no
from register_stident;
metrik ailec%ROWTYPE;

cursor iomega is
select course_code
from register_stident;
subject iomega%ROWTYPE;

BEGIN

open ailec;
loop
fetch ailec into metrik;
exit when ailec%NOTFOUND;

If ailec%FOUND then --if metric no found
open iomega;

loop
fetch iomega into subject;
exit when iomega%NOTFOUND;

if iomega%FOUND then --if course_code found
alert := show_alert('success');
luck := 0;
while luck < 1 loop

--if cursor same with :block_course.course_code
if (subject.course_code = :block_course.course_code) then
alert := show_alert('part1');

--if cursor not same with :block_course.course_code
elsif(subject.course_code !=:block_course.course_code)
then
alert := show_alert('part2');
commit;

end if;
alert := show_alert('part3');
luck = luck + 1;
end loop;

end if;
end loop;
end if;

end loop;

Close ailec;
close iomega;

END;


i have difficulty to enable the cursor fall into if...elsif...end if condition.pls help me.

can one trigger have two or more cursor?the reason i have two cursor because, i want the program to exit if either metric_no or course_code not found. pls advice!
Re: cursor in condition rule(if..elsif...end if;) [message #4490 is a reply to message #4489] Sat, 14 December 2002 12:20 Go to previous message
Robert Kuhlmann
Messages: 35
Registered: March 2002
Member
Better you Check ailec%isopen
Previous Topic: Paging In PL/SQL
Next Topic: How to increase quota size for table space ?
Goto Forum:
  


Current Time: Thu May 16 12:44:06 CDT 2024