oracle 存储过程
1.参数传入传出
创建:
CREATE OR REPLACE PROCEDURE getSalaryByEmpNo(eNo
IN NUMBER,salary
OUT NUMBER)
AS
BEGIN
SELECT SAL INTO
salary FROM EMP WHERE EMPNO=eNo;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('没有找到该编号的员工');
END;
执行:
命令窗口下,
DECLARE
salary NUMBER(7,2);
BEGIN
getSalaryByEmpNo(7788,salary);
DBMS_OUTPUT.PUT_LINE(salary);
END;