# Salary Increases Using Loops - Exercise

Salary Increases Using Loops - Exercise

# Salary Increases Using Loops

Duration: 10 to 15 minutes.
1. Start with the program that prints out person's name, salary and the current date (using simple variable assignment).
2. Add a loop that displays the numbers one through ten. This number will represent the beginning of a series of lines that each represent one year.
3. Add code to display the date incremented by one year and name beside each of the numbers one through ten. (Review the use of the ADD_MONTHS if needed).
4. Add code that increments the salary by 5% per year (Compound interest)

## Code Sample:

Within-the-Block/Exercises/salary_increase_exercise.sql
```DECLARE
v_name VARCHAR2(45);
v_current_date DATE;
v_salary NUMBER;

BEGIN

dbms_output.put(v_name);
dbms_output.put(' ' ||
trim(to_char(v_salary,'\$999,999,999.00')));
dbms_output.put_line(' ' || v_current_date);

END;
```

## Solution:

Within-the-Block/Solutions/salary_increase_solution.sql
```DECLARE
v_name VARCHAR2(45) := 'Larry Ellison';
v_current_date DATE := current_date;
v_salary NUMBER     := 1.00;
BEGIN

FOR i IN 1..10 LOOP

dbms_output.put(' ' || v_name);
dbms_output.put(' ' ||
trim(to_char(v_salary,'\$999,999,999.00')));
dbms_output.put_line(' ' || v_current_date);