create or replace PROCEDURE kimtest_UPDATESALARYIWITHINOUT(P_EMPLOYEEID IN NUMBER,P_SALARYPERCENT IN NUMBER, P_SALARY OUT NUMBER)
IS
-- declare local variable
-- get data and put into variable--
SP_SALARY number;
Begin
if P_SALARYPERCENT > 0 then
-- get salary from table put into variable
select employee_salary into SP_SALARY
from kimtest_employee
where employee_id = P_EMPLOYEEID;
--check value parameter out --
P_SALARY := SP_SALARY;
DBMS_OUTPUT.PUT_LINE('=====IF STATEMENT SALARY UPDATED===='|| P_SALARY);
-- update salary from table and multiply with increament percent
SP_SALARY := SP_SALARY + (SP_SALARY*P_SALARYPERCENT);
--put data to parameter OUT
P_SALARY := SP_SALARY;
-- show output of parameter out that should be update
DBMS_OUTPUT.PUT_LINE('=====IF STATEMENT SALARY UPDATED===='|| P_SALARY);
--updata salary back to database
update kimtest_employee
set employee_salary = SP_SALARY
where employee_id = P_EMPLOYEEID;
else
DBMS_OUTPUT.PUT_LINE('===ELSE STATEMENT====');
end if;
//assign value for input
$S_EMPLOYEEID = 1;
$S_SALARYPERCENT = 0.1;
//execute procedure
oci_execute ($objParse);
// Display OUT : pRowFound
echo "data of employee id : ".$S_EMPLOYEEID."<br/>";
echo "data of salary percent : ".$S_SALARYPERCENT."<br/>";
echo "data of salary after procedure : ".$S_SALARY."<br/>";