异常
1.预定义异常2.非预定义异常3.自定义异常
declare
name emp.ename%type;
begin
select ename into name from emp where deptno=10;
exception
when no_data_found then
dbms_output.put_line('没有数据');
when too_many_rows then
dbms_output.put_line('值太多');
end;
-- 记录类型
declare
areaid varchar2(20);
type total is record(
PAR_ID tb_area_code.par_area_id%type,
AREA_NAME tb_area_code.area_name%type
);
v_total total;
begin
select t.par_area_id,t.area_name into v_total from tb_area_code t where t.area_id = 'BD0312';
dbms_output.put_line(v_total.PAR_ID||v_total.AREA_NAME);
end;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12961536/viewspace-769496/
,如需转载,请注明出处,否则将追究法律责任。