A line is not getting printed
DECLARE
R integer(10);
N varchar(20);
B VArchar(20);
Y VARCHAR(10);
A Integer(10);
E varchar2(10);
CURSOR s IS
SELECT RollNo,Name, Branch, Year, Attendance_Percentage, Event FROM N_ROLLCALL
WHERE branch='Comp' ORDER BY ROLLNO;
BEGIN
OPEN s;
LOOP
FETCH s INTO R,N,B,Y,A,E ;
EXIT WHEN s%notfound;
BEGIN
DBMS_OUTPUT.PUT_LINE(' ROLLNO:'||R||' NAME:'||N||' BRANCH:'||B||' YEAR:'||Y||' ATTANDANCE_PERCENTAGE:'||A||' EVENTS:'||E);
END;
END LOOP;
CLOSE s;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
dbms_output.put_line('You have tried to insert a duplicate roll_no.');
WHEN OTHERS THEN
dbms_output.put_line ('An error has occurred inserting a roll_no.');
END;
Output that I am getting
1 row(s) inserted.
0.01 seconds
But the line that I want to print using dbms_output.put_line is not getting printed when I have rows more than one which have branch ='comp'. If there is only one such entry then it is getting printed.