存储过程:
CREATE OR REPLACE PROCEDURE stu_proc(v_name IN VARCHAR2 DEFAULT '张三', v_id OUT NUMBER) AS
--声明语句段
BEGIN
--执行语句段
SELECT id INTO v_id FROM student where sname=v_name;
EXCEPTION
--异常处理语句段
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('NO_DATA_FOUND');
END;
调用:
DECLARE
i NUMBER ;
BEGIN
stu_proc('张三',i);
dbms_output.put_line('查询到的ID为: '||i);
END;
标签:语句,存储,调用,PLSQL,--,NUMBER,返回值,id
From: https://www.cnblogs.com/dengxing/p/17130187.html