CREATE OR REPLACE PROCEDURE EMPANNSAL(P_SAL IN OUT NUMBER)
IS
BEGIN
P_SAL := P_SAL*12;
END EMPANNSAL;
/
-- INVOKING FROM THE HOST
VARIABLE G_SAL NUMBER
BEGIN
:G_SAL := 5000;
END;
/
PRINT G_SAL
EXECUTE EMPANNSAL(:G_SAL)
PRINT G_SAL
-- INVOKE FROM ANOTHER PROCEDURE
CREATE OR REPLACE PROCEDURE EMPANSAL(P_DEPT IN NUMBER)
IS
CURSOR EMPCUR IS SELECT LAST_NAME,SALARY
FROM EMPLOYEES
WHERE DEPARTMENT_ID=P_DEPT;
V_SAL NUMBER;
BEGIN
FOR EMPREC IN EMPCUR LOOP
DBMS_OUTPUT.PUT_LINE(EMPREC.LAST_NAME||' GETS ANNUALY ');
V_SAL := EMPREC.SALARY;
EMPANNSAL(V_SAL);
DBMS_OUTPUT.PUT_LINE(V_SAL);
END LOOP;
END EMPANSAL;
/
SHO ERR
EXECUTE EMPANSAL(50)
0 comments:
Post a Comment
Thank you for your comments we will get back to soon