Optimize Query
CREATE OR REPLACE Procedure TotalIncome ( name_in IN varchar2 ) IS total_val number(6);
cursor c1 is select monthly_income
from employees
where name = name_in;
BEGIN
total_val := 0;
FOR employee_rec in c1 LOOP
total_val := total_val + employee_rec.monthly_income;
END LOOP;
END;
-----------------------
Question # 1 – Re-write the above procedure. Please optimize it for speed and execution.
Question #2 – Describe how to embed test data inside the production schema+database instance.
What are the pros and cons on this approach?
If you have done this in the past, describe the problem you were trying to solve and whether it was successful.