Hello,
I am new to PL/SQL and having GREAT difficulty with the following:
Create a stored procedure which processes one employee record (pass
an employee number as a parameter to the procedure). Call your function,
TOTAL_PAY, created in a previous step and insert a record into the BONUS table if
the employee’s total pay is at least $2000. The record to be inserted should have an
increased amount for commission by 10% if they have a commission or it should set
it to $100 if commission is null. Otherwise (total pay is not at least 2000), display a
message with DBMS_OUTPUT.PUT _LINE which shows the employee’s name and
salary such as “Employee SMITH has total pay of $1800”.
I have created TOTAL_PAY as:
I am new to PL/SQL and having GREAT difficulty with the following:
Create a stored procedure which processes one employee record (pass
an employee number as a parameter to the procedure). Call your function,
TOTAL_PAY, created in a previous step and insert a record into the BONUS table if
the employee’s total pay is at least $2000. The record to be inserted should have an
increased amount for commission by 10% if they have a commission or it should set
it to $100 if commission is null. Otherwise (total pay is not at least 2000), display a
message with DBMS_OUTPUT.PUT _LINE which shows the employee’s name and
salary such as “Employee SMITH has total pay of $1800”.
I have created TOTAL_PAY as:
Code:
create or replace function total_pay (emp_no IN emp.empno%type) return NUMBER is CURSOR grp_cur is select SUM (SAL + COMM) from emp where empno = emp_no; return_value NUMBER; Begin OPEN grp_cur; FETCH grp_cur into return_value; CLOSE grp_cur; RETURN return_value; END;
Comment