Hi
I'm just trying to develope a very simple stored procedeure, but its not working correctly. Code;
CREATE OR REPLACE PROCEDURE test_member (memberID IN Number)
IS
CURSOR member_cur is
SELECT no_of_late
FROM member;
late_number number(3);
BEGIN
open member_cur;
loop
fetch member_cur into late_number;
DBMS_OUTPUT.PUT_LINE('Number of Lates : '
|| late_number);
exit when member_cur%NOTFOUND;
-- exit when member_cur%ROWCOUNT > memberID;
END LOOP;
close member_cur;
END;
--------------------------------
I get a "Procedure created" in sql*plus
I then try to test it (exec test_off(2) << "2" is a memberID). I was expecting then when meberID "2" is placed in the () I should get back on screen the number of lates (a field within a member table), but i don't. I do get a result back, and from what I can see its the results for everything;
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 1
Number of Lates : 0
Number of Lates : 1
Number of Lates : 1
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
PL/SQL procedure successfully completed.
Any idea why?
I'm just trying to develope a very simple stored procedeure, but its not working correctly. Code;
CREATE OR REPLACE PROCEDURE test_member (memberID IN Number)
IS
CURSOR member_cur is
SELECT no_of_late
FROM member;
late_number number(3);
BEGIN
open member_cur;
loop
fetch member_cur into late_number;
DBMS_OUTPUT.PUT_LINE('Number of Lates : '
|| late_number);
exit when member_cur%NOTFOUND;
-- exit when member_cur%ROWCOUNT > memberID;
END LOOP;
close member_cur;
END;
--------------------------------
I get a "Procedure created" in sql*plus
I then try to test it (exec test_off(2) << "2" is a memberID). I was expecting then when meberID "2" is placed in the () I should get back on screen the number of lates (a field within a member table), but i don't. I do get a result back, and from what I can see its the results for everything;
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
Number of Lates : 1
Number of Lates : 0
Number of Lates : 1
Number of Lates : 1
Number of Lates : 0
Number of Lates : 0
Number of Lates : 0
PL/SQL procedure successfully completed.
Any idea why?