Procedure with parameter to add two numbers

BY DEFAULT IN
*****************************

CREATE OR REPLACE PROCEDURE
ADDF(N1 NUMBER,N2 NUMBER) IS
N3 NUMBER;
-- ADD TWO NUMBER
BEGIN
N3:=N1+N2;
DBMS_OUTPUT.PUT_LINE(N3);
END;
/

******************************
TO USE OUT PARAMETER BIND VARIABLE NEED TO BE CREATE

PROCEDURE: TO GET EMPLOYEE SALARY BASED ON EMPLOYEE ID

VARIABLE N1 NUMBER;

CREATE OR REPLACE PROCEDURE
GET_SAL(EID IN EMP.EMPNO%TYPE,SALARY OUT EMP.SAL%TYPE) IS
BEGIN
SELECT SAL INTO SALARY FROM EMP WHERE EMPNO=EID;
END;

EXECUTE GET_SAL(7788,:N1);

PRINT :N1;
Previous
Next Post »