hi OTN. im having alittle trouble with my update procedure. I am trying to update my
salaries with a small equation in apex my procedure fires and everything but it will only update my table after i submit my page for the second time. in other words, when i want to change work out the net salary, i punch the value in, i click submit, and nothing happens, but when i go another employee, and do the same thing, the information i just put in by the previous employee is used to populate the net salary
this is the table structure:
| Column Name | Data Type | Nullable | Default | Primary Key |
|---|
| EMPLOYEE_ID | NUMBER(5,0) | No | - | 1 |
| SALARY | NUMBER(7,2) | No | - | - |
| COMMISSION_PCT | NUMBER(5,2) | Yes | - | - |
| SALARY_DEDUCTION | NUMBER(7,2) | Yes | - | - |
| OVER_TIME | NUMBER(5,0) | Yes | - | - |
| PENALTIES | NUMBER(5,0) | Yes | - | - |
| BONUS | NUMBER(7,2) | Yes | - | - |
| NET_SALARY | NUMBER(8,2) | Yes | - | - |
This is the procedure i am using
create or replace PROCEDURE update_salary_new(
p_employee_id IN NUMBER ,
p_salary IN NUMBER,
p_salary_deduction IN NUMBER,
p_penalties IN NUMBER,
p_bonus IN NUMBER,
p_over_time IN NUMBER,
p_commission_pct IN NUMBER)
IS
BEGIN
update salaries
set net_salary = (p_salary - nvl(p_salary_deduction,0) - nvl(p_penalties,0) + nvl(p_bonus,0) + nvl(p_over_time,0)),
salary = p_salary,
salary_deduction = nvl(p_salary_deduction,0),
penalties = nvl(p_penalties,0),
bonus = nvl(p_bonus,0),
over_time= nvl(p_over_time,0),
commission_pct = nvl(p_commission_pct,0)
where employee_id = p_employee_id;
commit;
end;
and this is how i link it to my dynamic action button in apex :
update_salary_new(
p_employee_id => :P7_EMPLOYEE_ID ,
p_salary => :P7_SALARY,
p_salary_deduction => :P7_SALARY_DEDUCTION,
p_penalties => :P7_PENALTIES,
p_bonus => :P7_BONUS,
p_over_time => :P7_OVER_TIME,
p_commission_pct => :P7_COMMISSION_PCT);
any help would be appreciated. i have been struggling for over a day now
***Moderator action (Timo): moved from to for better alignment.***