I have been working on this function problem for over two days (homework assignment). I cannot figure out how to do it and am not finding any help in doing this. Here is the problem:
Create PL/SQL function (EMP_SAL_DIFF) that accepts an employee number (P_EMPLOYEE_ID) and returns the difference between the average salary in the department the employee works for and the employee’s salary.
In addition, create a driver program that runs the function against every employee in the EMPLOYEES table. Show all work including the output from running the procedure.
Here is the work that I have done so far, but its only the part about obtaining the salary for a certain employee.
Create or replace function get_Sal ( P_EID IN NUMBER) RETURN NUMBER
WHERE EMPLOYEE_ID = P_EID;
variable g_sal NUMBER
EXECUTE :g_sal := get_Sal (199)
Help would be greatly appreciated!! I think I've pulled out all my hair while trying to do this.