1当select a into b, a为空的时候该怎么处理。
2以及游标返回查询到的结果
3 当查询输入的查询条件为空时,查询所有
PROCEDURE procdure( id in number;
backcontent out sys_refcursor)
is
v_name varchar2(30);
begin
begin
select NAME
into v_name
from STUDENT;
EXCEPTION
WHEN NO_DATA_FOUND THEN
raise_application_error(-20112,'###没有数据!###');
end;
open backcontent for --使用游标 将查询的结果数据返回
select * from STUDENT
where (id is null or ID = id); --id为空时 查询所有学生,id不为空 查询ID = id 的学生。
end procdure;