系统exception,以及自定义例外
来源:互联网 发布:软件总工程师简历 编辑:程序博客网 时间:2024/05/16 09:06
/*
Zero_Divide ( 被零除)
*/
set serveroutput on
declare
pnum number;
begin
pnum := 1/0;
exception
when Zero_Divide then dbms_output.put_line(‘1: 0不能做被除数’);
dbms_output.put_line(‘2: 0不能做被除数’);
when Value_error then dbms_output.put_line(‘算术错’);
when others then dbms_output.put_line(‘其他例外’);
end;
/
–自定义例外: 查询50号部门的员工姓名
set serveroutput on
declare
cursor cemp is select ename from emp where deptno=50;
pename emp.ename%type;
–自定义例外
no_emp_found exception;
begin
open cemp;
–取一个员工
fetch cemp into pename;
if cemp%notfound then
raise no_emp_found;
end if;
/*
if cemp%isopen then
close no_emp_found;
end if;
*/
close cemp;
exception
when no_emp_found then dbms_output.put_line(‘没有找到员工’);
when others then dbms_output.put_line(‘其他例外’);
end;
/
- 系统exception,以及自定义例外
- 关于系统例外和自定义例外
- 自定义例外
- oracle 使用例外exception
- Oracle:例外exception
- Exception 例外處理
- PL/SQL exception(例外)
- 系统例外
- oracle 自定义例外
- PL/SQl自定义例外
- PL/SQL例外概念和系统例外
- oracle pl/sql 例外(exception) 异常
- 浮点数例外 Floating Point Exception
- C#自定义异常处理(自定义例外)
- 例外
- 例外
- 例外
- 例外
- IOS创建二维码
- 大数阶乘
- Android网络数据请求之HttpClient
- 驱动程序与应用程序之间共享内存
- jquery的ready事件的实现机制浅析
- 系统exception,以及自定义例外
- data URI scheme(图片直接保存在html页面的方法)
- [Linux] awk命令笔记 入门
- 苹果绿-护眼-色值
- (java)leetcode Lowest Common Ancestor of a Binary Search Tree
- 通常高级程序设计语言包含的语法内容
- 反调试技术揭秘
- oracle单行函数
- ActionBar/Toolbar左侧右侧空白处理