 |
|
Oracle
Pseudocode for Annual_Review() Procedure
Oracle Tips by
Burleson
|
After determining how each individual requirement can be met, we
can write some pseudocode that puts the logic for the procedure
together. This allows us to clarify our thoughts about the procedure
and to put those same thoughts into a form that can be looked over by
someone who is more familiar with the business rules.
Listing 4.27 shows the pseudocode for the Annual_Review()
procedure.
Listing 4.27 Pseudocode for the Annual_Review()
procedure.
open a cursor of all employees;
for each employee loop
determine how often the employee has been on time;
if the employee is on time more than 98% then
grant a .5% raise;
if the employee has no late days then
grant another .1% raise;
end if;
end if;
if the employee has four or more warnings then
skip this employee -- no raise;
end if;
if performance rating is higher than 8 then
grant a .5% raise;
end if;
calculate the new salary;
update the base_salary column in the EMPLOYEES table;
end loop;
commit changes;
if any errors occur then
rollback;
end if;
This pseudocode seems like it will do the trick, but looking at it
a little more closely, we notice that we’re checking the warnings
after doing some other things. Because warnings can disqualify the
employee from getting a raise, the procedure will work a bit more
quickly if no work is done until after the warnings are checked.
Figure 4.2 illustrates the logical execution of the procedure.
Figure 4.2 The logical
execution of the Annual_Review() procedure.
This is an excerpt from the book "High Performance Oracle
Database Automation" by Jonathan Ingram and Donald K.
Burleson, Series Editor. |