G-4110: Always use %NOTFOUND instead of NOT %FOUND to check whether a cursor returned data.
Minor
Maintainability
Reason
The readability of your code will be higher when you avoid negative sentences.
Example (bad)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | declare cursor employee_cur is select last_name ,first_name from employee where commission_pct is not null; r_employee employee_cur%rowtype; begin open employee_cur; <<read_employees>> loop fetch employee_cur into r_employee; exit read_employees when not employee_cur%found; end loop read_employees; close employee_cur; end; / |
Example (good)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | declare cursor employee_cur is select last_name ,first_name from employee where commission_pct is not null; r_employee employee_cur%rowtype; begin open employee_cur; <<read_employees>> loop fetch employee_cur into r_employee; exit read_employees when employee_cur%notfound; end loop read_employees; close employee_cur; end; / |