13PL_SQL过程之错误处理即捕获异常
2016-06-26 20:26
507 查看
declare
v_temp number(4);
begin
select empno into v_temp from emp where deptno=10;
exception
when too_many_rows then
dbms_output.put_line('太多记录了');
when others then
dbms_output.put_line('error!');
end;
declare
v_temp number(4);
begin
select empno into v_temp from emp where empno=2222;
exception
when no_data_found then
dbms_output.put_line('没有数据');
end;
v_temp number(4);
begin
select empno into v_temp from emp where deptno=10;
exception
when too_many_rows then
dbms_output.put_line('太多记录了');
when others then
dbms_output.put_line('error!');
end;
declare
v_temp number(4);
begin
select empno into v_temp from emp where empno=2222;
exception
when no_data_found then
dbms_output.put_line('没有数据');
end;
相关文章推荐
- 12PL_SQl过程之三种循环
- 11PL_SQL过程之创建表
- MongoDB安装
- 10PL_SQL过程之执行if语句
- MYSQL-----索引
- 09PL_SQL过程之执行insert语句
- 08PL_SQL过程之执行select语句
- 07PL_SQL过程之复杂数据类型之Record
- 06PL_SQL过程之复杂数据类型Table
- 05PL_SQL过程之使用%type声明变量
- 04PL-SQL过程之声明各种简单变量
- 03PL_SQL过程之捕获异常
- 02PL_SQL过程之声明变量
- 01PL_SQL过程之输出HelloWorld
- spark:scala读取mysql的4种方法
- 数据库结构的设计与如何最大限度的利用索引
- SQL一次性查询一个字段不同条件下的统计结果
- MySQL存储过程
- SQL错误:”***“必须是批处理中仅有的语句
- MySQL基本操作