Write a PL/SQL Program to hike the i.Employee salary as 35% if employee having a salary. ii.If employee not having a salary rise the user exception and give the salary 3000.
0
Write a PL/SQL Program to hike the
i.Employee salary as 35% if employee having a salary.
ii.If employee not having a salary rise the user exception and give the salary 3000.
SQL>DECLARE
Salary_missing EXCEPTION;
i emp%rowtype;
BEGIN
i.empno:=&eno;
SELECT ename,sal into i.ename, i.sal
FROM emp
WHERE empno=i.empno;
IF i.sal IS NULL THEN
RAISE salary_missing;
ELSE
i.sal:=i.sal+i.sal*0.25;
UPDATE emp SET sal=i.sal
WHERE empno=i.empno;
display(‘The emp det are ‘||i.ename||’ ‘||i.sal);
END IF;
EXCEPTION
WHEN no_data_found THEN
display(i.empno||’ is not exists’);
display(SQLCODE||’ ‘||SQLERRM);
WHEN salary_missing THEN
display(‘The emp is not having any salary so give salary as 3000’);
UPDATE emp SET sal=i.sal
WHERE empno=i.empno;
display(SQLCODE||’ ‘||SQLERRM);
WHEN others then
display(‘The SUHE’);
END;
0 comments: