Code Listing 6: Switching to a simple loop and avoiding redundant code

 1  DECLARE
 2     l_fine PLS_INTEGER := 0;
 3     l_date DATE := SYSDATE;
 4     l_overdue_count NUMBER := 1;
 5  BEGIN
 6     LOOP
 7        EXIT WHEN
 8          (l_overdue_count <= 0 OR l_fine >= 10)
 9
10        update_fine_info (l_date, l_one_day_fine);
11
12        l_fine := l_fine + l_one_day_fine;
13
14        l_date := l_date + 1;
15
16        l_overdue_count :=
17           overdue_pkg.countem (
18              borrower_id => borrower_in,
19              l_date);
20*    END LOOP;