Tuesday, October 21, 2014

Write the PL/SQL code to input the emp’s no and increase the salary by 10% if his salary < 5000 otherwise delete the record.




DECLARE
ENO NUMBER;
SALARY NUMBER;
BEGIN
ENO := &EMPNO;
SELECT SALARY INTO SAL FROM EMP WHERE EMPNO = ENO;
IF SALARY < 5000 THEN
UPDATE EMP SET SAL = SAL + SAL *.1 WHERE EMPNO = ENO;
DBMS_OUTPUT.PUT_LINE(‘SALARY UPDATE’);
ELSE
DELETE FROM EMP WHERE EMPNO = ENO;
DBMS_OUTPUT.PUT_LINE(‘RECORD DELETED’);
END IF;
END;

No comments: