Write a PL/SQL Program to hike the employee salary as 35% if entered employee salary not less than(<) 2000. If salary is less than(<) 2000 display the message and suspend the program process.
0
Write a PL/SQL Program to hike the employee salary as 35% if entered employee salary not less than(<) 2000. If salary is less than(<) 2000 display the message and suspend the program process.
SQL>DECLARE
i emp%rowtype;
BEGIN
i.empno:=&eno;
SELECT ename,sal into i.ename,ilsal
from emp
where empno=i.empno;
IF i.sal<2000 THEN
Raise_application_error(-20345,’The emp sal is less than 2000 so no updation’);
i.sal:=i.sal+i.sal*0.35;
UPDATE emp set sal=i.sal
WHERE empno=i.empno;
ELSE
i.sal:=i.sal+i.sal*0.35;
UPDATE emp set sal=i.sal
WHERE empno=i.empno;
display(‘The emp det are’||i.ename||’ ‘||i.sal);
END IF;
END;
0 comments: