打印功能开启oracle set serveroutput on
(1)定义存储过程
CREATE OR REPLACE PROCEDURE PRC_GETDESCRIPTION
(pid IN CHAR, pdesc OUT VARCHAR2)
BEGIN
SELECT DESCRIPTION INTO pdesc
FROM SCOTT.PRODUCT
WHERE PRODID=pid;
END PRC_GETDESCRIPTION;
(2)调用存储过程
DECLARE
pdesc VARCHAR2(500);
BEGIN
PRC_GETDESCRIPTION('P070920001', pdesc);
DBMS_OUTPUT.PUT_LINE(pdesc);
END;